[R] Calling data within a function (was First Variable in lm)
Gabor Grothendieck
ggrothendieck at myway.com
Thu Mar 25 13:12:26 CET 2004
Christian Hoffmann <christian.hoffmann <at> wsl.ch> writes:
> ggrothendieck <at> myway.com
> -----------------------
> data(longley)
> lm( longley[,7] ~. , data = longley[,-7] )
>
> You cannot call data() inside a function:
To call data() within a function:
f <- function() {
data(longley, envir = environment())
lm( longley[,7] ~. , data = longley[,-7] )
}
More information about the R-help
mailing list