[R] Dealing with Duplicates - How to count instances?

jim holtman jholtman at gmail.com
Fri Feb 2 19:55:55 CET 2007


table(data[column])

will give you the number of items in each subgroup; that would be the
count you are after.

On 2/2/07, Johannes Graumann <johannes_graumann at web.de> wrote:
> Hi there,
>
> given a data.frame 'data' I managed to filter out entries (rows) that are
> identical with respect to one column like so:
>
> duplicity <- duplicated(data[column])
> data_unique <- subset(data,duplicity!=TRUE)
>
> But I'm trying to extract how many duplicates each of the remaining rows
> had.
>
> Can someone please send me down the right path for this?
>
> Joh
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list