From ripley at stats.ox.ac.uk  Mon Aug  2 08:41:42 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Aug  2 08:41:46 2004
Subject: [Rd] directing print.packageInfo to a file
In-Reply-To: <16653.52730.383537.81882@mithrandir.hornik.net>
Message-ID: <Pine.LNX.4.44.0408020739510.30735-100000@gannet.stats>

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


[Rd] directing print.packageInfo to a file
Prof Brian Ripley