s-news
[Top] [All Lists]

Re: Removing duplicates from Rows

To: Jagadish Rangrej <jrangrej@yahoo.com>
Subject: Re: Removing duplicates from Rows
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Tue, 27 Sep 2005 15:42:15 -0500
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <20050927202759.77723.qmail@web54414.mail.yahoo.com>
Organization: PDF Solutions, Inc.
References: <20050927202759.77723.qmail@web54414.mail.yahoo.com>
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)


Jagadish Rangrej wrote:
hi!
I have duplicates in a table, using two columns to
identify the duplicity. How can I remove the
duplicates is there any single line trick ?

Thanks,
Jag



See ?unique or ?duplicated.

Probably you want:

data[!duplicated(data[c("col1", "col2")]), ]

If "col1" and "col2" are the only columns in data, then you simply need:

unique(data)

HTH,

--sundar

<Prev in Thread] Current Thread [Next in Thread>