Did you try data<-ID[[i]] instead of your data<-ID[i]? Kjetil
On Tue, Feb 9, 2010 at 11:19 AM, kayj <kjaj...@yahoo.com> wrote: > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.