ggrothendieck at myway.com
Sun Jul 25 06:25:49 CEST 2004
Spencer Graves <spencer.graves <at> pdf.com> writes:
: 1. I failed to make method 1 work, though I've done that kind of
: thing in the past, and I believe I could make it work if I had to.
I am using R 1.9.1 patched on Windows XP and at least there it seems
to work. I did notice that I put a forward slash in the type statement
whereas I meant a backward slash although the forward slash worked anyways,
at least on my system. Here is the output of an R session:
R> readLines("/mypager.bat") # check content of mypager.bat file
 "type %1 > /myfile.txt"
R> old <- options()
R> options(pager = "/mypager.bat")
R> help(package = "mclust")
R> options(old) # reset options back if finished
R> head(readLines("/myfile.txt")) # check 1st few lines of myfile.txt
 "" " Information on
 "" "Description:"
 "" "Package: mclust"
 "R version 1.9.1, 2004-07-13"
: 4. A request for "packageInfo.print" returned "object ... not
: found". A request for class(mclustInfo) confirmed that it was a
: packageInfo object, so I tried getMethod("print", "packageInfo"); I
: got, 'No generic function defined for "print"'. Then I tried,
: getMethod("show", "packageInfo"); I got, 'No method defined for
: function "show" and signature object = "packageInfo"'.
Sorry about that. I should have written print.packageInfo since
the syntax of these things is genericmethod.class and print is the
generic method and packageInfo is the class.
: Gabor Grothendieck wrote:
: >Spencer Graves <spencer.graves <at> pdf.com> writes:
: >: I wanted to direct packageInfo to a file, so I could add comments,
: >: e.g., in MS Word. The following command stored the desired information
: >: in an object:
: >: mclustInfo <- help(package="mclust")
: >: Then "mclustInfo" displays it on my screen. To direct it to a
: >: file, I tried the following:
: >: sink("mclust.txt")
: >: mclustInfo
: >: sink()
: >: This sequence created an empty file "mclust.txt", while displaying
: >: mclustInfo on my screen. After a few more failed attempts, I gave up
: >: trying to be clever and copied the text from the screen into Word.
: >In addition to your copy and paste solution:
: >1. You could intercept the file.show output by redefining the pager:
: > a. create a one line file called mypager.bat in \ with this line:
: > type %1 > /mclust.txt
: > (with appropriate modifications if you are using UNIX).
: > b. In R issue these commands:
: > old <- options()
: > options(pager = "/mypager.bat")
: > help(package = "mclust")
: > options(old) # reset options back if finished
: >2. Don't use R but go right to the DESCRIPTION and INDEX
: > files. getwd("library/mclust") should show you where
: > to find them.
: >3. If you don't care about the formatting:
: > sink("/mclust.txt")
: > writeLines(unlist(help(package="mclust")$info))
: > sink()
: >4. You could modify packageInfo.print adding a file= argument.
: >R-help <at> stat.math.ethz.ch mailing list
: >PLEASE do read the posting guide! http://www.R-project.org/posting-
: R-help <at> stat.math.ethz.ch mailing list
: PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help