[R] apply question

Michaell Taylor pols1oh at bestweb.net
Tue Mar 5 23:19:46 CET 2002


Sorry to bother the list with another apply question, but I am having
trouble getting my mind around the various apply forms.  A simplified
version of my problem is the following:

data _
data.frame(ct=seq(1,10),a1=rnorm(10),a2=rnorm(10),a3=rnorm(10),b=rnorm(10))
listofAvars _ grep('^a',names(data),value=T)

I would like a1, a2, a3 to be multiplied by 10. That is, I would like a
cleaner way of specifying the following:

a1 <- a1*10
a2 <- a2*10
a3 <- a3*10

As I mentioned, this is a simplified version of a larger variables list
and slightly more complicated transformation.

Thanks in advance,

Michaell Taylor


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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