(out <- make_taxon(genus="Poa"))
(out <- make_taxon(genus="Poa", epithet="annua", authority="L."))
(out <- make_taxon(genus="Poa", epithet="annua", authority="L.",
family='Poaceae', clazz='Poales', kingdom='Plantae', variety='annua'))
out$binomial
out$binomial$canonical
out$binomial$species
out$binomial$authority
out$grouping
out$grouping$family
out %>% pick(family) # get a single rank
out %>% span(kingdom, family) # get a range of ranks
gethier(out) # get hierarchy as data.frame
# Using dplyr
df <- data.frame(class=c('Magnoliopsida','Magnoliopsida','Magnoliopsida',
'Magnoliopsida','Magnoliopsida','Magnoliopsida'),
order=c('Asterales','Asterales','Fagales','Poales','Poales','Poales'),
family=c('Asteraceae','Asteraceae','Fagaceae','Poaceae','Poaceae','Poaceae'),
genus=c('Helianthus','Helianthus','Quercus','Poa','Festuca','Holodiscus'),
species=c('annuus','petrus','kellog','annua','arundinaceae','fava'),
stringsAsFactors = FALSE)
library(dplyr)
xx <- df %>% rowwise()
xx %>% do(i = strain(make_taxon(.$species, genus = .$genus), . < family)) %>% .[[1]]
xx %>% do(i = strain(make_taxon(.$species, genus = .$genus), . < genus)) %>% .[[1]]
xx %>% do(i = strain(make_taxon(.$species, genus = .$genus), . < species)) %>% .[[1]]
Run the code above in your browser using DataLab