[R] Getting the current number of rows in windows R gui console (Carlos Arias)

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jan 22 03:12:25 CET 2014

On 14-01-21 7:27 PM, Carlos Arias wrote:
> Hello, I'm currently trying to set some default settings and I know how to
> get the width of the console with getOption("width"), this corresponds to
> the number of columns of the console in the Rconsole file. I would also
> like to get the current number of rows from inside R. Is there an R option
> to get this value?

options("width") gives you the line length that various R functions use; 
it doesn't necessarily tell you the window width.  (Setting the window 
width does update the option value, but not vice versa.)

There aren't functions to get window size at the R level, though you 
could theoretically use getWindowsHandle() to get the handle of the R 
console Window, and use Windows API functions to get its measurements. 
You can use loadRconsole() to load new settings from a file.

Duncan Murdoch

More information about the R-help mailing list