[R] How to obtain a cross tab count of unique values

Walter Anderson wandrson01 at gmail.com
Tue Mar 31 21:51:12 CEST 2015


I have a data frame that shows all of the parks (including duplicates)
that are impacted by a projects 'footprint':

PROJECT PARKNAME
A       PRK A
A       PRK B
A       PRK A
B       PRK C
B       PRK A
C       PRK B
C       PRK D
...

What I need is a cross tabulation that shows me the number of unique
parks for each project.  If I using the standard table(df$PROJECT) it
reports:

A 3
B 2
C 2
...

where I need it to ignore duplicates and report:

A 2
B 2
C 2
...

Anyone have any suggestions on how to do this within the R paradigm?

Walter Anderson



More information about the R-help mailing list