[R] putting output from print() into a string?
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Sun Nov 12 21:19:25 CET 2000
On 12 Nov 2000, Peter Dalgaard BSA wrote:
> Uwe Ligges <ligges at statistik.uni-dortmund.de> writes:
>
> > On Sun, 12 Nov 2000, David Firth wrote:
> >
> > > Is there some neat way of storing the printed representation of an
> > > object as a character string? I can see how it could be done via
> > > disk using sink() and then scan(), but that's ugly.
> > >
> > > Something like Lisp-Stat's "with-output-to-string" macro perhaps?
> >
> > dump() ?
>
> I don't think that was what David was looking for. If you really want
> to postprocess the printed output, the sink-then-scan method would
> seem to be the way to do it (or the soon-to- be readLines() instead of
> scan()). I suppose that a sink(text=...) could be implemented, but
> AFAIK it is not on anyones TODO list.
Sure it is. Output connections to a character vector solves this, I
believe. I have had a prototype running, but doubt if this will make 1.2.
Indeed, I suspect what David really wants is a socket as an output
connection. (`Connections' are S4-speak for general hooks for input and
output streams.)
Brian
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list