[R] Summing x1 to x6

Pablo pschatfield at gmail.com
Mon Dec 19 17:00:44 CET 2011


Suppose I have the following:

x1<-as.vector(rnorm(10))
x2<-as.vector(rnorm(10))
x3<-as.vector(rnorm(10))
x4<-as.vector(rnorm(10))
x5<-as.vector(rnorm(10))
x6<-as.vector(rnorm(10))
x7<-as.vector(rnorm(10))
x8<-as.vector(rnorm(10))
x9<-as.vector(rnorm(10))
x10<-as.vector(rnorm(10))

I would like the mean of x1 to x6 for each vector position.  I would do
something else with x7-x10.  These vectors are not currently in a dataframe. 
I tried to be clever by trying get(paste(paste("x", 1:6, sep=""),
collapse="+")) but it didn't work.  Any thoughts are greatly appreciated,

Pablo

--
View this message in context: http://r.789695.n4.nabble.com/Summing-x1-to-x6-tp4214604p4214604.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list