SOLVED: Re: [R] help output paged in separate window

(Ted Harding) Ted.Harding at
Tue May 27 10:52:20 CEST 2003

May I thank everyone who chipped in with suggestions and comments about
this question.

On one contribution: Robert Espresso suggested how to amend Jim Lemon's
function 'helpless' so as to put it in the background.
This works (as far as putting it in the background is concerned).
However, by experiment I found that Jim's function is limited because
of the way it looks for what to feed to 'less' and it sometimes succeeds
but in general will not succeed and so 'less' will get empty input.
E.g., with Robert's mod of Jim's function, compare the results of
"?library" (which works) with "?RNGkind" (which doesn't).

However, after a little reflection (which I could have done earlier ... )
I've found a very straightforward solution for Unix systems, outlined
below, which allows anything which would have been sent to R's pager to be
shown on a separate and fully-detached window using 'less'. The details
shown have been implemented in Linux, but the principles are applicable
on all Unix and the method should work either exactly as it is or with
minor modifcations.

1. Create a file in your $PATH with name "pgr" containg the lines

  #! /bin/bash
  export HLPFIL=`mktemp R_hlp.tmp.XXXXXX`
  cat > $HLPFIL
  xterm -e less $HLPFIL &

and make it executable ("chmod 755 pgr"). (You may want to change the
first line, depending on your shell, or you may well be able to omit it
altogether). The 'mktemp' function generates a filename which is unique
within its directory.

2. Give R the command


where "pgr" can be replaced by a full pathname if required.

That's it: Now try "?library", ""random")", "help(RNGkind)"
or anything else!

If you use this a lot, you will find it handy to have a method of
automatically deleting all the "R_hlp.tmp.XXXXXX" files you've created
in a session.

Best wishes to all,

More information about the R-help mailing list