PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, August 14, 2022

[FIXED] How to increase amount of output retained by R console

 August 14, 2022     console, output, r, rstudio     No comments   

Issue

I'm struggling with how much output is retained in RStudio's console. An MWE would be:

for(i in 1:2000){print(i)}

Of the 2,000 printed iterations, only 1,000 lines are retained in the RStudio console. In other words, scrolling up all the way to the top of the RStudio console, the output is truncated at a printed i of 1001.

To emphasize: these are separate instances of printing to the console, so this has nothing to do with the "max.print" option (which we set to options(max.print=100000) anyway). This is solely about the number of lines retained by RStudio's console, or put differently, the absolute "height" of the console.

This is not an issue when running R through a terminal.

Is someone aware of an RStudio option to increase the amount of lines retained in its console? The RStudio options "Limit output line length" and "Limit visible console output" in Tools > Global Options > Console do not influence this behavior.

Thanks and best, Chris


Solution

you can use rstudioapi::writeRStudioPreference("console_max_lines", <<Number of Lines>>). <<Number of Lines>> needs to be and Integer so 2000L not 2000. Then restart RStudio and it will be updated. Be cautious though, this can slow down RStudio a lot for large values.



Answered By - Julian_Hn
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing