# 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))
# The indexes of all supertaxa (with supertaxa of supertaxa, etc) for each taxon
supertaxa(x)
# Return something other than index
supertaxa(x, value = tax_name(x))
# Include each taxon with its supertaxa
supertaxa(x, value = tax_name(x), include = TRUE)
# Only return data for some taxa (faster than subsetting the whole result)
supertaxa(x, subset = 3)
Run the code above in your browser using DataLab