[R] can't get summary() in loop
Bill Simpson
wsi at gcal.ac.uk
Tue Feb 20 14:40:29 CET 2001
The problem is illustrated below:
line<-function(x,y)
{
fit<-lm(y~x)
fit
}
func<-function()
{
x<-c(1,2,3,4)
y<-c(1.1,2,3,4)
for(i in 1:2)
{
fit<-line(x,y)
summary(fit)
}
}
Why don't I get two printed summaries when I run func()? How to make it
work? (In reality I will be getting different summaries of different data
sets using this loop)
Thanks very much for any help.
Bill Simpson
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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