Wacek Kusnierczyk wrote: > > x[[q]] is equivalent to x[['some']][['more']][['not_there']]. since > x[['some']] is an atomic integer vector, it won't collaborate with > [['more']] >
æsj, one more lousy statement. x[['some']] is an atomic *double* vector *with no element named 'more'*, hence x[['some']][['more']] won't work. anyway, the point is that 'some' is used as an index on the first element of x, rather than on x itself -- because of the recursive indexing. one might argue that recursive indexing should be done explicitly, by repeating the use of [[, and that [[q]] performing recursive indexing when length(q) > 1 is yet another 'optimization' in r that easily leads to confusion. it is not unreasonable to think that x[[q]] might return a concatenation of the respective elements of x: x = as.list(1:2) x[1] # [[1]] 1 x[1:2] # [[1]] 1 # [[2]] 2 x[[1]] # 1 x[[1:2]] # 1 2 (but it will rather fail) vQ ______________________________________________ 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.