[R] source output differs from console output

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Sat Oct 26 06:45:23 CEST 2002


1) When you use source() you need to explicitly print results, and not
rely on auto-printing.

2) write() is not the way to write to a file, except for matrices. Use
cat() directly. In any case, you don't want to write the summary to the
file, but the printed version produced by the print method for the summary
object.

So add some print() statements to your script and all should be well.

On Fri, 25 Oct 2002, graham lawrence wrote:

> I would like to be able to run the following code sequence as a source
> routine.
> If I paste it into R via the clipboard it works as expected, but if I source
> the code instead then the last 3 statements fail.
> I've also tried writing to the file in place of the sink sequence, but that
> also hits a snag.  R 1.6, w98e2, dfr is a data frame containing the content
> of Julian Faraway's gala data frame.  I append the console log and 3 outputs
> to the file.

[...]

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