On Mon, 18 Dec 2006, Robin Hankin wrote:

> Hi
>
> I used write() the other day to save some results.

Why not save()?  It is the only way to preserve the results exactly.

> It seems that write() does not record the full precision of
> the objects being written:
>
>
> > write(pi,file="~/f",ncolumns=1)
> > pi.saved <- scan("~/f")
> Read 1 item
> > dput(pi)
> 3.14159265358979
> > dput(pi.saved)
> 3.141593
> > pi-pi.saved
> [1] -3.464102e-07
> >
>
>
> This difficulty was particularly difficult to find because pi.saved
> *looks*
> the same as pi.
>
>
>
> What's going on here?

See ?cat, for which write is a wrapper.

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
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

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to