8

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...

Community
  • 1
  • 1
statquant
  • 13,672
  • 21
  • 91
  • 162
  • did you read the answer [here](http://stackoverflow.com/questions/3412911/r-exe-rcmd-exe-rscript-exe-and-rterm-exe-whats-the-difference). it looks like Rterm.exe can be ignored these days. – agstudy Feb 16 '13 at 23:10
  • 1
    Yes I red this post, but in WinXP Rgui.exe do not have the features I refered about (backward search via CTRL+R etc...) – statquant Feb 17 '13 at 11:45
  • Hey, thanks. Sorry we did not find any solution. I was thinking, as a far-fetch, have you considered using CygWin? That brings a load of other complications, though. – Oscar de León Feb 27 '13 at 21:53
  • Hey Oscar, can't really use it, it's my workstation at work so no admin no nothing... Plus If I had the choice I would simply change the OS ;) – statquant Feb 27 '13 at 21:57

3 Answers3

4

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).

Oscar de León
  • 2,331
  • 16
  • 18
2

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".

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • 1
    Hello, thanks, the whole question was to the number of characters displayed before the $ such that I can write loooooong lines on the console. See what I mean ? – statquant Feb 25 '13 at 07:07
  • No I do not see. You want character counts of non-visible portion of the line??? (You can write long lines to the console so I do not see a problem there.) – IRTFM Feb 25 '13 at 17:10
  • 1
    When I write a looooong line to an Rterm terminal, at some point a `$` sign appear, meaning that I achieved the maximal number of character on one line, and If I write further the begining of the line is not visible anymore. If I write `abcd tttttttttttttttttttttt` at some point I get `abcd tttttttttttttttttttttt$` meaning the maximal number of character is reached then if I continue and would like to write "new" I will get `d ttttttttttttttttnew$` (start of line invisible) – statquant Feb 25 '13 at 17:38
  • As I said earlier. .... if you want to go to the end of a line that is being entered, type CTRL-e. You will then see the "$? switch over to the left side of the console and you will be able to see "$tttt....tttttend" on the display. If this is not what you were requesting then please try to say what you want to see. (Your description of what happens is not what happens on my machine. On my copy of Rterm 2.15 running in WinXP. typing input at the the right-hand side of a console will shift the `$` to the left side and allow you to see the right hand text.) – IRTFM Feb 25 '13 at 18:55
  • 1
    What I want to see is : the whole line without any `$` so `abcd ttttttttttttttttttttttttttnew` I do not want this `$` limitation. – statquant Feb 25 '13 at 19:49
  • You are choosing to use Rterm.exe, which is not a program that can be expected to offer any sort of GUI-like features. It is clearly oriented to sync with 'readline' as explained above. The Mac-R-GUI and the RStudio IDE do offer a wrap-around, multi-line display, so it is possible. You could try to see whether anyone has built a 'readline' replacement for Windows or UNIX that offers your desired feature set. – IRTFM Feb 25 '13 at 20:03
  • Ok, thanks, I opened another question that if solved would allow me to switch to `Rgui` : http://stackoverflow.com/questions/15073114/how-can-i-set-rgui-exe-for-backward-search may be you'll have the answer – statquant Feb 25 '13 at 20:32
1

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.

Richie Cotton
  • 118,240
  • 47
  • 247
  • 360
  • I am using vim-r-plugin, though the console vim-R-plugin uses is the one you select, in my case Rterm.exe (Jackson allowed on my demand), setting option(width=180) is just setting how R print things, not how many character are displayed when you type a command... (am I clear) – statquant Feb 18 '13 at 16:01
  • It sounds like the issue is either with the vim or the plugin or the shell, rather than with R. – Richie Cotton Feb 18 '13 at 16:55
  • 3
    Having done some testing, I'd agree with @statquant that the problem seems to be with Rterm.exe. setting `options(width = 180)` or similar makes Rterm print output (e.g. data frames, vectors, etc.) with the greater width. However, when typing a command at the `>` prompt, when you get to the ~80th column, the text moves to the left and shows `> $`, followed by the last 60 to 80 characters of what you've typed. When you then press , the first ~80 characters that you typed on the previous line are shown after the `> `, followed by a `$`, but the rest of the text is not shown. – Simon Feb 18 '13 at 19:51
  • Thanks for reproducing mate – statquant Feb 19 '13 at 08:23
  • RStudio also seems to respect the width option. – Brandon Bertelsen Feb 22 '13 at 20:18