[R] setdiff for data.frames?

Gabor Grothendieck ggrothendieck at gmail.com
Thu Mar 12 23:11:30 CET 2009


Try this:

library(sqldf)
BODsub <- BOD[1:3,]
sqldf("select * from BOD except select * from BODsub")

For more see: http://sqldf.googlecode.com

On Thu, Mar 12, 2009 at 5:58 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
>
> I have two data.frames.
>
> One is the subset of the other.  I need to determine what rows were removed from the superset data.frame to form the subset data.frame.
>
> I was hoping to turn up functionality similar to setdiff for data.frames, but did not have any luck.   It seems I need to find a function that performs the oposite as "merge".
>
>
>> dim(superset_dataframe)
> [1] 248  31
>> dim(subset_dataframe)
> [1] 214  31
>
> Thank you for any suggestions of functions that might exist that might help.
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list