[R] How x[, 'colname1'] is implemented?

2009-12-31 Thread Peng Yu
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?

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread milton ruser
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

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread Peng Yu
On Fri, Jan 1, 2010 at 4:24 PM, milton ruser milton.ru...@gmail.com wrote: 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)] Thank you! But this is not what I'm asking. I want to know how

Re: [R] How x[, 'colname1'] is implemented?

2009-12-31 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu Sent: Thursday, December 31, 2009 2:16 PM To: r-h...@stat.math.ethz.ch Subject: [R] How x[, 'colname1