Hi
r-help-boun...@r-project.org napsal dne 04.03.2009 13:18:30: > Hello > I am am new to R and any help with the following would be appreciated: > I have a list (example attached) and I would like to create a new list > which is a filtered version of this list. I.e I would like a list that > only contains elements with this value: > > Chr 10 : 21853562 - 21855482 Lists can have quite complicated structure so here is only a small suggestion lapply(your.list, function(x) x==desired.value) This shall give you list of logical values if your list has only one level. Something like pts <- list(x=mtcars[,1], y=mtcars[,2], z=mtcars[,10]) pts[which(unlist(lapply(pts, function(x) sum(x==4)>0)))] Regards Petr > > Any pointers/tips would be great. > Thanks! > Nikol > > -- > Bioinformatician/Computer Associate > Cambridge Institute for Medical Research > University of Cambridge > Wellcome Trust/MRC Building > Hills Road > Cambridge > CB2 0XY > 01223 762111 > > [[1]] > human../US45102804_251757910002_S01_CGH-v4_95_Feb07.chr10.cher1 > Chr 10 : 21853562 - 21855482 > Antibody : ./US45102804_251757910002_S01_CGH-v4_95_Feb07 > Maximum level = 0.5370385 > Score = 3.193875 > Spans 19 probes. > Defined extras: typeUpstream, typeInside, distMid2TSS, upSymbol, inSymbol, type > > [[2649]] > human../US45102804_252058310010_S01_CGH-v4_95_Feb07.chrX.cher18 > Chr X : 72387424 - 72387712 > Antibody : ./US45102804_252058310010_S01_CGH-v4_95_Feb07 > Maximum level = 0.3504706 > Score = 0.4045575 > Spans 4 probes. > Defined extras: typeUpstream, typeInside, distMid2TSS, upSymbol, inSymbol, type > > [[2650]] > human../US45102804_252058310010_S01_CGH-v4_95_Feb07.chrX.cher19 > Chr X : 129037305 - 129037494 > Antibody : ./US45102804_252058310010_S01_CGH-v4_95_Feb07 > Maximum level = 0.4718157 > Score = 0.5751177 > Spans 3 probes. > Defined extras: typeUpstream, typeInside, distMid2TSS, upSymbol, inSymbol, type > > [[2651]] > human../US45102804_252058310010_S01_CGH-v4_95_Feb07.chrX.cher20 > Chr X : 129048386 - 129048865 > Antibody : ./US45102804_252058310010_S01_CGH-v4_95_Feb07 > Maximum level = 0.3711013 > Score = 0.4121159 > Spans 5 probes. > Defined extras: typeUpstream, typeInside, distMid2TSS, upSymbol, inSymbol, type > > [[2652]] > human../US45102804_252058310010_S01_CGH-v4_95_Feb07.chrX.cher21 > Chr X : 129065300 - 129066038 > Antibody : ./US45102804_252058310010_S01_CGH-v4_95_Feb07 > Maximum level = 0.4387153 > Score = 1.515073 > Spans 8 probes. > Defined extras: typeUpstream, typeInside, distMid2TSS, upSymbol, inSymbol, type > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.