Re: [R] help(package)->sink()

From: Gabor Grothendieck <ggrothendieck_at_myway.com>
Date: Sun 25 Jul 2004 - 04:21:55 EST

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:
  2. 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@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jul 25 04:30:58 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:37:56 EST