[R] r scripting

Jon Erik Ween jween at klaru-baycrest.on.ca
Thu Jun 18 16:50:09 CEST 2009


Hi!

I have a dataset with some 300+ variables and 2000+ records. I'd like to grind
through a bunch of analyses on the variables by using a script, but can't
figure out how to refer to variable names properly. For some of the simpler
stuff I use various "apply" functions, but for others (like t-tests etc) I need
by command procedures. I've tried various flavors of "for(var in
names(Dataset)){...}" but this does not work consistently. Actually, "for(var
in names(Dataset){print var}, seems to work perfectly, giving a list of
variable names, but "for(var in names(Dataset)){mean(var, na.rm=T) or for(var
in names(Dataset)){glm(var~var1+var2+var3....} do not.

Any suggestions about how best to go about this?

Thanks

Jon




More information about the R-help mailing list