Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Rui Barradas
Hello, I've made Petr's solution a bit more general Petr Savicky wrote > > On Mon, Feb 27, 2012 at 07:10:57PM +0100, Arnaud Gaboury wrote: >> No, but I tried your way too. >> >> In fact, the only three unique rows are these ones: >> >> Product Price Nbr.Lots >>Cocoa 24405 >>

Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Petr Savicky
On Mon, Feb 27, 2012 at 07:10:57PM +0100, Arnaud Gaboury wrote: > No, but I tried your way too. > > In fact, the only three unique rows are these ones: > > Product Price Nbr.Lots >Cocoa 24405 >Cocoa 24501 >Cocoa 24406 > > Here is a dirty working trick I fo

Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Rui Barradas
Hello, > > In fact, the only three unique rows are these ones: > > Product Price Nbr.Lots >Cocoa 24405 >Cocoa 24501 >Cocoa 24406 > The code below doesn't give the three in one step. (ixmat <- apply(reported, 1, function(x) apply(exportfile, 1, function(

Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Arnaud Gaboury
rnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] compare two data frames of different dimensions and only keep unique rows is this what you want: > v <- rbind(reported, exportfile) > v[!duplicated(v), ] ProductPrice Nbr.Lots 1Cocoa 2331.00 -61 2

Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread jim holtman
is this what you want: > v <- rbind(reported, exportfile) > v[!duplicated(v), ] ProductPrice Nbr.Lots 1Cocoa 2331.00 -61 2Cocoa 2356.00 -61 3Cocoa 2440.005 4Cocoa 2450.001 6 Coffee C 204.55 40 7 Coffee C 205

[R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Arnaud Gaboury
Dear list, I am still struggling with something that should be easy: I compare two data frames with a lot of common rows and want to keep only rows that are NOT in both data frames, unique. Here are an example of these data frame. reported <- structure(list(Product = structure(c(1L, 1L, 1L, 1L