Re: [Rd] directing print.packageInfo to a file

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 02 Aug 2004 - 16:41:42 EST


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@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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
Received on Mon Aug 02 16:48:26 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:04 EST