[R] Recursive indexing failed at level 2

Jim Hargreaves james at ipec.co.uk
Sat Jun 26 13:53:45 CEST 2010


Dear fellow R users,

I am replacing elements of a list like so:

pulse_subset[[1:20]]=unlist(pulse[i])[1:20]

where pulse is a list of lists, and pulse [i] has >20 values.

This gives the error "Recursive Indexing failed at level 2". But, 
interestingly this instruction is part of a loop which has gone through 
about 200,000 iterations before giving this error.

Actual code:
 > 
pulse_subset[[1:(length(unlist(pulse[i])[as.numeric(peak_start[i]):as.numeric(peak_end[i])]))]] 
<- unlist(pulse[i])[as.numeric(peak_start[i]):as.numeric(peak_end[i])]

Error in 
pulse_subset[[1:(length(unlist(pulse[i])[as.numeric(peak_start[i]):as.numeric(peak_end[i])]))]] 
<- unlist(pulse[i])[as.numeric(peak_start[i]):as.numeric(peak_end[i])] :
   recursive indexing failed at level 2

If anyone could shed some light I'd be rather grateful.

Regards,
Jim Hargreaves



More information about the R-help mailing list