onyourmark wrote:
>
> 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.
>
>
Your "for" loop didn't make any assignments.
How about
answer3 <- answer2[-(answer2[,1]==answer2[,2]),]
or
answer3 <- answer2[answer2[,1]!=answer2[,2],]
(which will be much faster than a loop anyway)
?
--
View this message in context:
http://www.nabble.com/deleting-rows-provisionally-tp23209365p23209468.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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.