[R] help(package)->sink()
Gabor Grothendieck
ggrothendieck at myway.com
Sat Jul 24 20:21:55 CEST 2004
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.
More information about the R-help
mailing list