[R] bug

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon May 3 16:23:12 CEST 1999

This is not a bug but a documented feature. If I do that in source, even
in Linux I do not get output from the summary call. Why? Because
you did not print it. Inside a function (and source is a 
function) autoprinting is turned off. You need to print
explicitly.  The function of summary() is to compute a summary,
not to print it. That is the job of print.summary.lm (not
the non-existent print.summary as ?summary.lm says).

You have discovered the the reason for the existence of rterm,
to process scripts.

On Mon, 3 May 1999, Geldenhuys, Willie wrote:

> -------------------------------------------------
> x<-rnorm(50)
> y<-12*x+30*rnorm(10)
> ff<-lm(y~x)
> sink("output.txt")
> print(ff) # this work give basic coefficients
> summary(ff) # should give Rsquare etc
> sink()
> -------------------------------------------------
> Having fitted a curve on a data set, I am trying 
> to write all the statistics about the fit to a 
> file. 
> In Linux, everything works OK, but in Windows NT:
> source("sink.R")
> the summary(ff) does NOT write anything to the 
> file. If you execute the same source via:  
> RTERM < sink.R everything works OK.

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