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

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue May 27 12:51:44 CEST 2003


On 27-May-03 Roger Bivand wrote:
> Or even use R to generate the shell script in a directory from
> tempdir():
> 
> .xthelp <- function() {
>     tdir <- tempdir()
>     pgr <- paste(tdir, "/pgr", sep="")
>     con <- file(pgr, "w")
>     cat("#! /bin/bash\n", file=con)
>     cat("export HLPFIL=`mktemp ", tdir, "/R_hlp.XXXXXX`\n", sep="",
> file=con)
>     cat("cat > $HLPFIL\nxterm -e less $HLPFIL &\n", file=con)
>     close(con)
>     system(paste("chmod 755 ", pgr, sep=""))
>     options(pager=pgr)
> }
> .xthelp()
> 
> source() this; then the files go away when R quits. This still leaves
> the function object in the global environment. The mode can also be
> 750 or tighter since execute permissions for other users seem a bit
> unnecessary?

Thanks! I like this even better than my previous solution, since it is
completely clean (and as a bonus it has taught me more about R)! I've put
the above code into my ~/.Rprofile (also adding the line "rm(.xthelp)" at
the end) on the assumption that I'm going to need this once and for all
throughout a session, but of course people may want to keep their options
open.

Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 27-May-03                                       Time: 11:51:44
------------------------------ XFMail ------------------------------




More information about the R-help mailing list