[Rd] directing print.packageInfo to a file

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 2 08:41:42 CEST 2004


On Mon, 2 Aug 2004, Kurt Hornik wrote:

> >>>>> Gabor Grothendieck writes:
> 
> > 
> > print.packageInfo does not print to the console, it uses file.show.
> > For example, on R 1.9.1 patched on Windows XP:
> > 
> >> require(chron)
> > [1] TRUE
> >> capture.output(print.packageInfo(help(package = chron)), file = "/abc.txt")
> > NULL
> >> length(readLines("/abc.txt"))
> > [1] 0
> 
> But file.show() can be tuned by playing with options(pager).
> 
> In your case, something like
> 
>   oop <- options(pager = function(file, ...) writeLines(readLines(file)))
>   capture.output(print.packageInfo(help(package = "stats")),
> 	         file = "abc.txt")
>   options(oop)
> 
> gives
> 
> R> length(readLines("abc.txt"))
> [1] 345

or even

oop <- options(pager="console")

an internal version of the same thing under R for Windows.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list