[R] R newbie example code question

Adrian DUSA dusa.adrian at gmail.com
Sat Jan 14 18:47:19 CET 2006


 <Ted.Harding <at> nessie.mcc.ac.uk> writes:
> [...]
> The solution I finally opted for, and still use,
> is based (in a Linux environment) on including
> the following code in your .Rprofile file:
> 
> .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()
> rm(.xthelp)
> 
> (and it's also specific to the 'bash' shell because
> of the "#! /bin/bash\n", but you should be able to
> change this appropriately). The above was posted by
> Roger Bivand on 27 May.
> [...]

I also like the function, it's beautiful. I wonder if anyone could help me with
the correct syntax for my bash shell (I assume this is the problem) because I
get this error:

Error in rm(.xthelp) : cannot remove variables from base namespace

when starting R and when installing a new package. 
Thank you,
Adrian




More information about the R-help mailing list