[R] plotting to stdout
Dirk Eddelbuettel
edd at debian.org
Fri Sep 7 22:10:18 CEST 2007
On Fri, Sep 07, 2007 at 02:27:00PM -0400, Duncan Murdoch wrote:
> On 9/7/2007 2:15 PM, Gene Selkov wrote:
> > Thanks a ton, Duncan!
> >
> > So I have verified that this line works:
> >
> > echo "postscript(file=\"\", command=\"cat\"); plot(0)" | r --vanilla --slave
> >
> > Wonderful! (albeit a little unobvious)
>
> I would include an explicit "dev.off()" after the plotting; I'm not sure
> all devices guarantee a clean shutdown when R quits.
And for the record, both littler and Rscript can do that without the
need for double quotes, at least under Linux. E.g. both
$ r -e 'postscript(file="", command="cat"); plot(0)' | head
$ Rscript -e 'postscript(file="", command="cat"); plot(0)' | head
provide the same output (of the beginning of the postscript output).
Our r is as usual somewhat faster, not that this matters in this
non-repeat context.
Dirk
--
Three out of two people have difficulties with fractions.
More information about the R-help
mailing list