Re: [Rd] [[ vs. .subset2

2008-07-05 Thread Peter Dalgaard
Gabor Grothendieck wrote: Not really. The point of this is that promises seem to be screwing up in conjunction with [[ but in light of the fact that .subset2 works it suggests that there might be a better implementation of [[ Not really; .subset2() is a shortcut that bypasses method dispatch, so

Re: [Rd] [[ vs. .subset2

2008-07-04 Thread Gabor Grothendieck
Not really. The point of this is that promises seem to be screwing up in conjunction with [[ but in light of the fact that .subset2 works it suggests that there might be a better implementation of [[. Also some insight into what is really driving this problem so one can more easily recognize it i

Re: [Rd] [[ vs. .subset2

2008-07-04 Thread Spencer Graves
Dear Gabor: Does the following answer your question: > tst <- list(a=1, b=2) > tst[numeric(0)] list() > tst[[numeric(0)]] Error in tst[[numeric(0)]] : attempt to select less than one element Spencer Gabor Grothendieck wrote: In the code below test2() gives an error message: Er

[Rd] [[ vs. .subset2

2008-07-04 Thread Gabor Grothendieck
In the code below test2() gives an error message: Error in .subset2(x, i, exact = exact) : attempt to select less than one element even though test(), which is nearly the same, gives the expected result. BOD is a data set that comes with R. Is this a bug? idx <- 2 # returns expected