Skip to content
Prev 286561 / 398502 Next

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

No, but I tried your way too.

In fact, the only three unique rows are these ones:

 Product Price Nbr.Lots
   Cocoa  2440        5
   Cocoa  2450        1
   Cocoa  2440        6

Here is a dirty working trick I found :
Product Price Nbr.Lots
3   Cocoa  2440        5
4   Cocoa  2450        1
?

My two problems are : I do think it is not so a clean code, then I won't know by advance which of my two df will have the greates dimension (I can add some lines to deal with it, but again, seems very heavy).

I hoped I could find a better solution.


A2CT2 Ltd.


-----Original Message-----
From: jim holtman [mailto:jholtman at gmail.com] 
Sent: lundi 27 f?vrier 2012 18:42
To: Arnaud Gaboury
Cc: r-help at r-project.org
Subject: Re: [R] compare two data frames of different dimensions and only keep unique rows

is this what you want:
Product    Price Nbr.Lots
1        Cocoa  2331.00      -61
2        Cocoa  2356.00      -61
3        Cocoa  2440.00        5
4        Cocoa  2450.00        1
6     Coffee C   204.55       40
7     Coffee C   205.45       40
5           GC 17792.00       -1
10 Sugar No 11    24.81       -1
8           ZS  1273.50       -1
9           ZS  1276.25        1
13       Cocoa  2440.00        6

        
On Mon, Feb 27, 2012 at 12:36 PM, Arnaud Gaboury <arnaud.gaboury at a2ct2.com> wrote:
--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.