Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change line length on Rterm.exe

Tags:

r

cmd

rgui

rterm

I am using R 2.15.2 on windows XP.

I was used to use Rgui.exe but it was lacking the UNIX standards I like to use like CTRL+R <=>backward research and CTRL+U <=>erase line ...

If I missed something please tell me !

Then I tried Rterm.exe (which looks identical to R.exe to me) which has all those nice features. I found how to tune it right clicking on the top of the window to set height-width (it is like tuning the window you get from cmd.exe).

The problem is that now I cannot see on the window more than 75 characters, with a $ at the end: like this:

R) ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp$

Not sure if it is a R option of a windows one, but if I set options("width"=180) I can see data.frame on the full width of the window...

Not sure what is happening, can I modify this?

We still do not know the answer to that one, so I guess 50 pts goes to Oscar de León... good for him to bad for me...

like image 865
statquant Avatar asked Jan 09 '13 14:01

statquant


3 Answers

Sadly, it appears to be built in.

There used to be a problem with R when trying to print long strings. Apparently it was fixed first in Rterm and other versions of R before being fixed in Rgui.

When Rgui was fixed, possibly it was by a different means, since this issue can be fixed in Rgui but not other windows versions of R. You can change the width of the console for output both in Rgui and (later) Rterm.

The prompt is another story. It is actually not the same as the output space, and thus is controlled with a different option; but, this only works for Rgui. To do it, set pgcolumns=180 in the Rconsole file under [R HOME]\etc\. This modifies the width of the internal pager of the Rgui console, and effectively enables you to type up to 180 characters per input prompt.

Possibly there is a way to integrate that behavior into Rterm, and maybe Duncan Murdoch can point you in the correct direction (or prove me completely wrong).

like image 83
Oscar de León Avatar answered Oct 21 '22 14:10

Oscar de León


I'm not really sure what is being requested. If what is needed in RTerm.exe is to display the end of a long line (and position the cursor there), then use CTRL-E. You can go back to the beginning of a line with CTRL-A. One can go back and forth repeatedly as needed until the line is use ENTER.

The control character of readline seem to be active, for instance CTRL-P scrolls back one command and CTRL-N brings up the "next" command from history if you hit CTRL-P too many times. (These are the same behavior as the up/down arrow keys.) See link for other expected readline behaviors.

On my machine alt-f and alt-b (which should have been meta-f and meta-b) did not natively move forward or backward by words, but ESC-b and ESC-f did so on a line that exceeded the console width and had the $'s marking either the right or left extents as having further material to look consider.

If you want to wrap display lines, then you need to consider alternatives or additions to readline: link, but that is an untested suggestion and merely the results of a search for: "readline wrap display".

like image 31
IRTFM Avatar answered Oct 21 '22 16:10

IRTFM


The command should be options(width = 180) (without the quotes around width), but when you run Rterm in the Windows shell, it doesn't respect changes to this value; it just prints output as wide as the console.

The best way of working with R is (almost always) to use an IDE. Try emacs + ESS or one of the many vim plugins (R.vim, vim-R, VIM:r-plugin) if you want something UNIXy.

like image 44
Richie Cotton Avatar answered Oct 21 '22 15:10

Richie Cotton