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.
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.
>
Dear Jason, On Thu, Mar 12, 2009 at 6:11 PM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> Try this: > > library(sqldf) > BODsub <- BOD[1:3,] > sqldf("select * from BOD except select * from BODsub") > > For more see: http://sqldf.googlecode.com >Also, please see http://finzi.psych.upenn.edu/R/R-devel/archive/26683.html and as a consequence of that discussion: library(prob) setdiff(A,B) Best, Jay *************************************************** G. Jay Kerns, Ph.D. Associate Professor Department of Mathematics & Statistics Youngstown State University Youngstown, OH 44555-0002 USA Office: 1035 Cushwa Hall Phone: (330) 941-3310 Office (voice mail) -3302 Department -3170 FAX E-mail: gkerns at ysu.edu http://www.cc.ysu.edu/~gjkerns/