[BioC] silly looping question

Nathalie Conte nac at sanger.ac.uk
Mon Oct 3 14:00:32 CEST 2011


dear List,
Sorry for the silly question, but I am a R beginner and try to sort 
something out.
I have a vector named match containing N positions
match=c( "1_880238", "1_883625", "1_1222695", "1_2255524" ,"1_887560")
I have a big data frame containing a lot of infos (among those positions 
in the first column V1 in the same format as in the match vector, 
example.txt attached )
I want to create an index to pull out only informations in the data 
frame whose position are the the vector.
I have tried this simple loop

for (i in match)
index=example$V1==i

new=example[index,]

the new dataframe contain only the last true element...is there a way to 
get all TRUE ones?
thanks
Nathalie




-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example.txt
URL: <https://stat.ethz.ch/pipermail/bioconductor/attachments/20111003/8afd7dcd/attachment.txt>


More information about the Bioconductor mailing list