[R] From replicate to accesing sublists

Alaios alaios at yahoo.com
Wed Apr 1 12:34:30 CEST 2015


Dear all,I have a R structure that was created with replicate.The data sets looks to be a matrix with each cell being a list.
str(error_suburban_0[,1],max.level=1)
List of 4
 $ vaR      :List of 20
  ..- attr(*, "class")= chr "variogram"
 $ Shadowing:List of 2
  ..- attr(*, "class")= chr "geodata"
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, "class")= chr "lm"


The error_suburban is a matrix that each field so 
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], error_suburban_0[,4],... and so on,  contains the four sublists
$ vaR      :List of 20
  ..- attr(*, "class")= chr "variogram"
 $ Shadowing:List of 2
  ..- attr(*, "class")= chr "geodata"
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, "class")= chr "lm"


I would like to pick for each of these matrix elements to collect only the $Shadowing sublist
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], error_suburban_0[,4]... and so on

Right now I am implementing this by a for loop that access each matrix element sequentially.

Can you please advice me if there is a better approach to do that in R?
Regards
Alex
 

	[[alternative HTML version deleted]]



More information about the R-help mailing list