[R] deleting rows provisionally
onyourmark
william108 at gmail.com
Fri Apr 24 05:56:15 CEST 2009
I have an object. I think it is a matrix, called 'answer2'
str(answer2)
int [1:1537, 1:2] 1 399 653 2 3 600 4 5 271 870 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:1537] "a4.1" "hirschsprung.399" "peritoneal.653" "abdomen.2"
...
..$ : chr [1:2] "row" "col"
I want to delete rows that have the same entries.
For example:
> answer2[4,1]
[1] 2
> answer2[4,2]
[1] 2
>
And so I would like to delete row 4.
I tried the following but it does not work.
I defined answer3 to hold the result by first:
>answer3<-answer2
and then:
> for(i in 1:1537){if(answer2[i,1]==answer2[i,2]){answer3[-i,]}}
Why doesn't this work?
Thanks.
--
View this message in context: http://www.nabble.com/deleting-rows-provisionally-tp23209365p23209365.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list