I have searched for methods to do this, but using count(unique()) doesn't search other factors. An example dataset is below.

```
df <- data.frame(Site = c("X1", "X1", "X1"), Date = c(2006, 2006, 2006), TaxonID = c("Chironomidae", "Saetheria", "Chimarra"), Family = c("Chironomidae", "Chironomidae", "Philopotamidae"), Genus = c("-", "Saetheria", "Chimarra"), Count = c(2, 1, 5), stringsAsFactors = FALSE)

+------+------+--------------+----------------+-----------+-------+
| Site | Date |   TaxonID    |     Family     |   Genus   | Count |
+------+------+--------------+----------------+-----------+-------+
| X1   | 2006 | Chironomidae | Chironomidae   | -         |     2 |
| X1   | 2006 | Saetheria    | Chironomidae   | Saetheria |     1 |
| X1   | 2006 | Chimarra     | Philopotamidae | Chimarra  |     5 |
+------+------+--------------+----------------+-----------+-------+

```

Counting TaxonID would over count, since in this case row 1 should not be counted due to something identified lower than that taxonomic level, i.e. row 2.

In this dataset, counting the unique values in Genus will work, but in an example where row 2 is not present, this will not.

This is a truncated table, where normally Phylum, Class, and Order are also present, and TaxonID may be something in one of those fields.