[R] summary() within a function

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 14 12:58:53 CET 2004


On Wed, 14 Jan 2004 uaca at alumni.uv.es wrote:

> 
> I have the following function
> 
> f <- function {
> 
> 	...
> 
> 	model <- lm(rttx[,1] ~ rttx[,2] + 0);
> 	summary(model);
> 
> 	...
> }
> 
> while summary(model) shows the summary if I execute the function line by line
> in the Command Line Interface, if I call f() summary is silent
> 
> how to solve it? or is there workaround?

You didn't do anything with the return value from summary(.lm).  You need 
to print() it, which happens automatically at the command line.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list