[R] Error in foo[[1:3]] : recursive indexing failed at level 2

ce zadig_1 at excite.com
Fri Jun 27 04:49:01 CEST 2014


Dear all,

I have a list of arrays :

foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) 

> foo
$A
[1] 1 3

$B
[1] 1 2

$C
[1] 3 1

I want to use all foo$A , foo$B and foo$C in a test :

> foo$A[1] == 1 
[1] TRUE
> foo[[1]][1] == 1 
[1] TRUE
> foo[[1:3]][1] == 1 
Error in foo[[1:3]] : recursive indexing failed at level 2


Is there a regular expression I can use ?



More information about the R-help mailing list