[R] intersect of 2 data frames

Salvatore Enrico Indiogine hindiogine at gmail.com
Sun May 6 21:11:49 CEST 2007


I am a new user of R.  The only one in my department, all others use SPSS.

I have two data sets of students with test scores, pretest and
posttest.  The first column StuNum and then columns of scores.

The problem is that the lists are slightly different not all students
are in both data sets.

So I did:

intersect(pretest$StuNum, posttest$StuNum) -> common.id

At this point I need to select from pretest the students in common.id
and do the same with posttest.

I have tried several things but, basically I do not know how to do so.

In SQL it should be something like:

select pretest$StuNum in common.id

Any pointers?


Enrico Indiogine

Mathematics Education
Texas A&M University
hindiogine a gmail.com

More information about the R-help mailing list