how to change line length on Rterm.exe
Asked Answered
G

3

9

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

Graphophone answered 9/1, 2013 at 14:30 Comment(4)
did you read the answer here. it looks like Rterm.exe can be ignored these days.Intuition
Yes I red this post, but in WinXP Rgui.exe do not have the features I refered about (backward search via CTRL+R etc...)Graphophone
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.Colombia
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 ;)Graphophone
C
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).

Clue answered 20/2, 2013 at 18:9 Comment(1)
very nice comment !!! thank you very much for all this information... very helpfullGraphophone
F
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".

Frankly answered 23/2, 2013 at 1:13 Comment(7)
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 ?Graphophone
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.)Frankly
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)Graphophone
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.)Frankly
What I want to see is : the whole line without any $ so abcd ttttttttttttttttttttttttttnew I do not want this $ limitation.Graphophone
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.Frankly
Ok, thanks, I opened another question that if solved would allow me to switch to Rgui : #15073614 may be you'll have the answerGraphophone
S
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.

Sandy answered 18/2, 2013 at 13:14 Comment(5)
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)Graphophone
It sounds like the issue is either with the vim or the plugin or the shell, rather than with R.Sandy
Having done some testing, I'd agree with @Graphophone 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 <enter>, 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.Argosy
Thanks for reproducing mateGraphophone
RStudio also seems to respect the width option.Shapiro

© 2022 - 2024 — McMap. All rights reserved.