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

2012-02-28 Thread Arnaud Gaboury
] compare two data frames of different dimensions and onlykeep unique rows 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 2440

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 with same columns names but of different dimensions

2012-02-27 Thread Gaurav Sood
m <- rbind(reported, exportfile) m1 <- m[duplicated(m),] m[is.na(match(m$key, m1$key)),] On Mon, Feb 27, 2012 at 9:46 AM, Arnaud Gaboury wrote: > Dear List, > > I want to compare and return the rows which are NOT in the two data frames. > Classic methods don't work as the df have NOT the same di

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

[R] compare two data frames with same columns names but of different dimensions

2012-02-27 Thread Arnaud Gaboury
Dear List, I want to compare and return the rows which are NOT in the two data frames. Classic methods don't work as the df have NOT the same dimensions. Here are one example of my df: reported <- structure(list(Product = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 3L, 4L, 5L, 5L), .Label = c("Cocoa"

Re: [R] Compare two data frames

2010-04-22 Thread Bert Gunter
.@r-project.org] On Behalf Of Paul Murrell Sent: Thursday, April 22, 2010 12:54 PM To: Doran, Harold Cc: r help Subject: Re: [R] Compare two data frames Hi Sounds like the 'compare' package might do some of what you want. Paul On 23/04/2010 1:41 a.m., Doran, Harold wrote: > I wonder if

Re: [R] Compare two data frames

2010-04-22 Thread Paul Murrell
Hi Sounds like the 'compare' package might do some of what you want. Paul On 23/04/2010 1:41 a.m., Doran, Harold wrote: I wonder if there is a more efficient way to do this task. Suppose I have two data frames, such as d1<- data.frame(x = c(1,2,3), y = c(4,5,6), z = c(7,8,9)) d2<- d1[, c('y'

Re: [R] Compare two data frames

2010-04-22 Thread David Winsemius
On Apr 22, 2010, at 9:41 AM, Doran, Harold wrote: I wonder if there is a more efficient way to do this task. Suppose I have two data frames, such as d1 <- data.frame(x = c(1,2,3), y = c(4,5,6), z = c(7,8,9)) d2 <- d1[, c('y', 'x')] The first dataframe d1 has more variables than d2 and the

[R] Compare two data frames

2010-04-22 Thread Doran, Harold
I wonder if there is a more efficient way to do this task. Suppose I have two data frames, such as d1 <- data.frame(x = c(1,2,3), y = c(4,5,6), z = c(7,8,9)) d2 <- d1[, c('y', 'x')] The first dataframe d1 has more variables than d2 and the variable columns are in a different order. So, what I