[R] create a new data frame after comparing two columns of the previous data frame

Nanami deconstructed.morning at gmail.com
Tue Jun 28 01:10:55 CEST 2011


it's a table; I read it from a file; I've tried to make it look prettier:

> head(intra)
 chr   miRNA   start     end       strand              ACC            
hsa_ID           region region_start region_end  
 chr1 miRNA 1102484 1102578      +   ACC="MI0000342"; ID="hsa-mir-200b";  
exon      1102484    1102578 
 chr1 miRNA 1103243 1103332      +   ACC="MI0000737"; ID="hsa-mir-200a";  
exon      1103243    1103332 
 chr1 miRNA 1104385 1104467      +   ACC="MI0001641";  ID="hsa-mir-429";  
exon      1104385    1104467 
 chr1 miRNA 3044539 3044599      +   ACC="MI0015861"; ID="hsa-mir-4251";  
exon      3044539    3044599 
 chr1 miRNA 3477260 3477354      -   ACC="MI0003556"; ID="hsa-mir-551a";  
exon      3477260    3477354 
 chr1 miRNA 6489894 6489956      -   ACC="MI0015864"; ID="hsa-mir-4252";  
exon      6489894    6489956 


When I changed && with &  I got this error:

> new <- intra[(intra$start != intra$region_start )&(intra$end !=
> intra$region_end)]
Error in `[.data.frame`(intra, (intra$start != intra$region_start) &
(intra$end !=  : 
  undefined columns selected

What I would like to do is to create a new table that only contains the rows
for which column start and region_start are not the same.



--
View this message in context: http://r.789695.n4.nabble.com/create-a-new-data-frame-after-comparing-two-columns-of-the-previous-data-frame-tp3628981p3629092.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list