Re: [R] Help with data.frame and lapply

From: TEMPL Matthias <Matthias.Templ_at_statistik.gv.at>
Date: Fri 16 Dec 2005 - 19:50:26 EST


> Hello:
> I'm having problems with this line of code:
>
> X.lm <- lapply(names(d), function(x) lm(d["cls"] ~ d[x], data=d))
>
> d[x] is what is giving trouble here, but I don't know
> exactly how to solve it.

How does d look like?
Probably d[,"cls"] and d[,x] instead of d["cls"] and d[x] solves your problem. PLEASE do read
the posting guide! http://www.R-project.org/posting-guide.html and *give a reproducible example*.

Best,
Matthias

> What I'm trying to do is to create a
> linear model from each column of the data frame 'd' to apply
> ANOVA later.
> Thanks very much in advance. Regards:
>
>
> Juan Daniel López Serna
>
> - ----
> Instituto de Ingeniería del Conocimiento
> (http://www.iic.uam.es)
> Universidad Autónoma de Madrid
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
>
> iD8DBQFDonvRXHsVbn2qIYMRAqi8AJ0X6zOAevAGzMczQ+ahHlVJnUK4ZQCeIDi6
> PPB3baK8JNOa3eoIgbmVCdM=
> =WKlt
> -----END PGP SIGNATURE-----
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read
> the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Dec 16 20:01:26 2005

This archive was generated by hypermail 2.1.8 : Fri 16 Dec 2005 - 23:42:38 EST