# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
# Find number of supertaxa each taxon is contained in
n_supertaxa(x)
# Only return data for some taxa (faster than subsetting the whole result)
n_supertaxa(x, subset = 1:3)
Run the code above in your browser using DataLab