r - finding non-identical entries across a row -
i have 2380 rows data.frame looks this:
> nstudentid1 nstudentid2 nstudentid3 1 80501010 80501010 80501010 2 80501022 80501022 80501022 3 80501005 80501005 80501005 4 80501003 80501003 80501003 5 80501026 80501026 80501026 6 80501025 80501025 80501025
as can see variables subject id's. each subject got 3 id's cross-validation.
usually want find duplicated entries within coulmn, did.
now check if each subject (row) has exactley same id number across 3 id variables.
i ran general check:
all(student1$nstudentid1 == student1$nstudentid2) all(student1$nstudentid1 == student1$nstudentid3) all(student1$nstudentid2 == student1$nstudentid3)
and got false answer.
how find non-identical row numbers?
any advice help
use condition filter :
condition <- student1$nstudentid1 == student1$nstudentid2 & student1$nstudentid1 == student1$nstudentid3 & student1$nstudentid2 == student1$nstudentid3; nonidenticalrows <- student1[!condition,]
to row numbers :
rownumbers <- which(!condition)
Comments
Post a Comment