Hi everyone, Suppose I have a list named "lst", see below:> lst$sub1 ... $sub1$x ... $sub1$y .... $sub2 ... $sub2$x ... $sub2$y ? $sub3 ... ... ... Now, I want to extract the sub-sublist $y from every sublist(sub1, sub2...) and then storage them to a new list. I know how to extract them by subscript or list name one by one, but I wonder if there exist some tricks to finish this job more automatically. Best regards, Richard @Sydney -- View this message in context: http://r.789695.n4.nabble.com/How-to-extract-sublist-from-a-list-tp3717451p3717451.html Sent from the R help mailing list archive at Nabble.com.
Thank you so much GlenB! I got it done using your method. I'm just curious how did you get this idea? Cause for me, this looks so tricky.... Cheers, Richard ----- I'm a PhD student interested in Remote Sensing and R Programming. -- View this message in context: http://r.789695.n4.nabble.com/How-to-extract-sublist-from-a-list-tp3717451p3717713.html Sent from the R help mailing list archive at Nabble.com.
Hi, have you considered using array, for example example<-array(1,dim=c(2,2,3)) dimnames(example)<-list(c("x1","x2"),c("y1","y2")) then if you want to extract the component "x1","y1" from every member of the list of matrices you have to example["x1","y1",] leaving blank in the last position. hope it helps. Victor -- View this message in context: http://r.789695.n4.nabble.com/How-to-extract-sublist-from-a-list-tp3717451p3717823.html Sent from the R help mailing list archive at Nabble.com.
Apparently Analagous Threads
- [LLVMdev] Saving a reference to a Basic Block?
- Problem/Bug when syncing subdirectory structures with delay-updates and partial-dir
- c(recursive=TRUE)
- [Bug 9670] New: missing substructure within partial-dir causes files to be lost or overwritten
- Re: [S] LME - fixed effects model and missing values