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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -