[R] performing the same commands on two different data sets

kayj kjaja27 at yahoo.com
Tue Feb 9 15:19:48 CET 2010


Hi All,


I would like to perform the same set of commands on the two different sets.
I would to avoid writing the same set of command twice so I was wondering if
there is an smart way to do this. I was thinking to use a loop as follows

Data<-read.table(file=”data.txt”, header=T, sep=’\t’)
D1<-Data[,1:30]
D2<-Data[,30:60]

ID<-c(“D1”,”D2”) 
for (i in 1:length(ID)){
data<-ID[i]

}

I can not assign D1 or D2 as data<-ID[i]? is there a way to do this?

Thanks


-- 
View this message in context: http://n4.nabble.com/performing-the-same-commands-on-two-different-data-sets-tp1474452p1474452.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list