Danardono wrote:>
> Hi all!
> Suppose we have this list:
>
x<-list("101"=list(t=c(1,3,4),n=3),"104"=list(t=c(1,2),n=2),"110"=list(t=c(5,6,3,4),n=4))
>
> (For example, 101, 104, 110 are ID number of subject, t and n are
> measurements belong to each subject)
>
> We can take subset of that list by, for instance,
> x$"101"
>
> But how do we select multiple subject? Is there any subset-like function
> for a list?
I dunno,
but the following should do the job:
> mysubset <- c("101","104")
> x[match(mysubset,names(x))]
I hope it helps...
Laurent
--
Laurent Gautier CBS, Building 208, DTU
PhD. Student D-2800 Lyngby,Denmark
tel: +45 45 25 24 85 http://www.cbs.dtu.dk/laurent
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._