[R] for (i in ...) { df[[i]]<- .....}

Wiener, Matthew matthew_wiener at merck.com
Fri Aug 27 15:27:49 CEST 2004


Take a look at "do.call".  

In your case, 'do.call("cbind", cc)' should work.

Hope this helps,

Matt Wiener

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Luis Rideau Cruz
Sent: Friday, August 27, 2004 9:12 AM
To: r-help at stat.math.ethz.ch
Subject: [R] for (i in ...) { df[[i]]<- .....}


R-help,

In the following loop :

for(i in 1:8)
{
cc[[i]]<-tapply(test[,i+6],list(puntar=test$puntar),sum)/tapply(test[,5],lis
t(puntar=test$puntar),sum)

cbind.data.frame(cc[[1]],cc[[2]],cc[[3]],cc[[4]],
cc[[5]],c[[6]],cc[[7]],cc[[8]])

}

Is there anyway I can 'cbind.data.frame' the objects cc[[ i ]] without
actually writing every single element??
In this case there are 8 but what if it is a large number??


Thank you

______________________________________________
R-help at 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




More information about the R-help mailing list