Hi Peng, If I undertood your point, try this:
x<-runif(10) y<-runif(10) z<-runif(10) w<-runif(10) myDF<-data.frame(cbind(x,y,z,w)) myDF myDF[,c("w","z")] Happy new year miltinho On Thu, Dec 31, 2009 at 5:15 PM, Peng Yu <pengyu...@gmail.com> wrote: > I don't see where describes the implementation of '[]'. > > For example, if x is a matrix or a data.frame, how the lookup of > 'colname1' is x[, 'colname1'] executed. Does R perform a lookup in the > a hash of the colnames? Is the reference O(1) or O(n), where n is the > second dim of x? > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ 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.