Hi folks, I use R in X windows on Linux. Normally, I use 'less' as pager, which is fine for scanning through 'help' (or '?') output in the R window itself; the help session is terminated by typing "q", as usual for 'less', and the R window then reverts to the R command line interface. Often, I would like to have the output from 'help' pop up in a separate window so that I can continue to work in the R window while reading the help. The "help" window could then be closed when interest in this particular help dwindles. What can I set $PAGER to, to achieve this? Or should it be done in a different way (e.g. using some option to 'help' or to 'file.show')? (I don't want to use 'help.start' because of the overhead of using an HTML browser) With thanks, and best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 167 1972 Date: 24-May-03 Time: 20:30:21 ------------------------------ XFMail ------------------------------
On 24-May-03 Ted Harding wrote:> I use R in X windows on Linux. > [...] > Often, I would like to have the output from 'help' pop up in a separate > window so that I can continue to work in the R window while reading the > help. The "help" window could then be closed when interest in this > particular help dwindles. > [...]Thanks to Jonathan Baron and Peter Dalgaard for private comments and help on this question. Peter in particular pointed out that library(tcltk); options(pager=tkpager) does the trick of detaching the pager from the R window exactly as desired, with relatively small overhead (as opposed to an HTML browser for 'help.start', or ESS: I put enough load on this 48MB laptop without having a multimegabyte Fat Man sitting on my memory). Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 167 1972 Date: 25-May-03 Time: 10:42:27 ------------------------------ XFMail ------------------------------
On Sun, 25 May 2003 10:42:27 +0100 (BST), Ted.Harding@nessie.mcc.ac.uk wrote in r-help:>Thanks to Jonathan Baron and Peter Dalgaard for private comments and help >on this question. Peter in particular pointed out that > library(tcltk); options(pager=tkpager)I notice a bug in the behaviour when used with help(). In Windows (and elsewhere?) the pager gets called through file.show, with the help topic given as the "header", rather than the "title". According to the docs, "title" is supposed to be an overall title common to all displayed files, while "header" is file-specific. In Windows, a combination of both args is used as the window title. However, tkpager only uses the "title" argument for the window title, putting "header" into the text being displayed, with the result that the windows end up with no title. Is this an inconsistency in the usage for "header" between Windows and other platforms, or a bug in tkpager? Duncan Murdoch
Ted Harding wrote:> Hi folks, > > I use R in X windows on Linux. > > Normally, I use 'less' as pager, which is fine for scanning through > 'help' (or '?') output in the R window itself; the help session is > terminated by typing "q", as usual for 'less', and the R window then > reverts to the R command line interface. > > Often, I would like to have the output from 'help' pop up in a separate > window so that I can continue to work in the R window while reading the > help. The "help" window could then be closed when interest in this > particular help dwindles. > > What can I set $PAGER to, to achieve this? Or should it be done in a > different way (e.g. using some option to 'help' or to 'file.show')? > > (I don't want to use 'help.start' because of the overhead of using > an HTML browser) >Well, here is a little function derived from the help browser macro I wrote for NEdit that will fire up an xterm with less displaying the help for a function. I haven't accounted for operators, but it could be done, and I haven't extensively tested it, but I suppose I shouldn't expect to have all the fun... Jim helpless<-function(topic) { topic<-substitute(topic) sys.command<-paste("locate ",topic,sep="",collapse="") helpfilelist<-system(sys.command,TRUE) helpmatch<-paste("help/",topic,sep="",collapse="") # find the R text help file(s) helpfile<-helpfilelist[grep(helpmatch,helpfilelist)] # assume that the shortest name matching "topic" will be the one if(length(helpfile) > 1) helpfile<-helpfile[which.min(nchar(helpfile))] sys.command<-paste("xterm -e less ",helpfile,sep="",collapse="") system(sys.command) }