[Rd] Very slow subsetting by name

2010-07-15 Thread Hervé Pagès
Hi, I'm subsetting a named vector using character indices. My vector of indices (or keys) is 10x longer than the vector I'm subsetting. All my keys are distinct and only 10% of them are valid (i.e. match a name of the vector being subsetted). It is surprisingly slow: x1 <- 1:1000 names(x1) <- pa

Re: [Rd] Very slow subsetting by name

2010-07-15 Thread Martin Morgan
On 07/15/2010 01:12 AM, Hervé Pagès wrote: > Hi, > > I'm subsetting a named vector using character indices. > My vector of indices (or keys) is 10x longer than the vector > I'm subsetting. All my keys are distinct and only 10% of them > are valid (i.e. match a name of the vector being subsetted).

Re: [Rd] Very slow subsetting by name

2010-07-15 Thread Martin Morgan
On 07/15/2010 08:38 AM, Martin Morgan wrote: > On 07/15/2010 01:12 AM, Hervé Pagès wrote: >> Hi, >> >> I'm subsetting a named vector using character indices. >> My vector of indices (or keys) is 10x longer than the vector >> I'm subsetting. All my keys are distinct and only 10% of them >> are valid