Message-ID: <5.0.2.1.2.20010322141453.009f3340@pop.tiscalinet.it>
Date: 2001-03-22T13:36:25Z
From: stefano iacus
Subject: two easy questions...
Hi all.
1) If I have a dataframe with variable names as follow: PC1 PC2 ... PCn and I want to pass only some of them to a function, e.g.
glm(resp~from PC1 to PC10, PC15, etc.,...)
is there a faster way than simply writing each variable name in the formula?
2) Again, I have a dataframe, say ali.df, with tha following variables: ali1, ali2, ...ali78
I want to sum, for example, ali1+al2+ali7+f rom ali10 to ali20 etc., then from ali4 to ali8, etc. and then put everything in a new dataframe
I'd do somthing like:
new.df <- cbind(apply(ali.df[c(1:2,7,10:20)],1,sum), apply(ali.df[4:8],1,sum)) and so on.
Is it the right and only way?
Thanks in advance (and forgive my orrible english...)
Stefano
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._