binomen
binomen provides various taxonomic classes for defining a single taxon, multiple taxa, and a taxonomic data.frame
It is designed as a companion to taxize, where you can get taxonomic data on taxonomic names from the web.
classes (S3)
taxontaxonreftaxonrefsbinomialgrouping(i.e., classification - used different term to avoid conflict with classification intaxize)
verbs
gethier()- get hierarchy from ataxonclassscatter()- make each row in taxonomic data.frame (taxondf) a separatetaxonobject within a singletaxaobjectassemble()- make ataxaobject into ataxondfdata.framepick()- pick out one or more taxonomic groupspop()- pop out (drop) one or more taxonomic groupsspan()- pick a range between two taxonomic groups (inclusive)strain()- filter by taxonomic groups, like dplyr's filtername()- get the taxon name for eachtaxonrefobjecturi()- get the reference uri for eachtaxonrefobjectrank()- get the taxonomic rank for eachtaxonrefobjectid()- get the reference uri for eachtaxonrefobject
Installation
Stable CRAN version
install.packages("binomen")Development GitHub version
install.packages("devtools")
devtools::install_github("ropensci/binomen")library('binomen')Make a taxon
Make a taxon object
(obj <- make_taxon(genus="Poa", epithet="annua", authority="L.",
family='Poaceae', clazz='Poales', kingdom='Plantae', variety='annua'))
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> kingdom: Plantae
#> clazz: Poales
#> family: Poaceae
#> genus: Poa
#> species: Poa annua
#> variety: annuaIndex to various parts of the object
The binomial
obj$binomial
#> <binomial>
#> genus: Poa
#> epithet: annua
#> canonical: Poa annua
#> species: Poa annua L.
#> authority: L.The authority
obj$binomial$authority
#> [1] "L."The classification
obj$grouping
#> <grouping>
#> kingdom: Plantae
#> clazz: Poales
#> family: Poaceae
#> genus: Poa
#> species: Poa annua
#> variety: annuaThe family
obj$grouping$family
#> <taxonref>
#> rank: family
#> name: Poaceae
#> id: none
#> uri: noneSubset taxon objects
Get one or more ranks via pick()
obj %>% pick(family)
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> family: Poaceae
obj %>% pick(family, genus)
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> family: Poaceae
#> genus: PoaDrop one or more ranks via pop()
obj %>% pop(family)
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> kingdom: Plantae
#> clazz: Poales
#> genus: Poa
#> species: Poa annua
#> variety: annua
obj %>% pop(family, genus)
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> kingdom: Plantae
#> clazz: Poales
#> species: Poa annua
#> variety: annuaGet a range of ranks via span()
obj %>% span(kingdom, family)
#> <taxon>
#> binomial: Poa annua
#> grouping:
#> kingdom: Plantae
#> clazz: Poales
#> family: PoaceaeExtract classification as a data.frame
gethier(obj)
#> rank name
#> 1 kingdom Plantae
#> 2 clazz Poales
#> 3 family Poaceae
#> 4 genus Poa
#> 5 species Poa annua
#> 6 variety annuaTaxonomic data.frame's
Make one
df <- data.frame(order = c('Asterales','Asterales','Fagales','Poales','Poales','Poales'),
family = c('Asteraceae','Asteraceae','Fagaceae','Poaceae','Poaceae','Poaceae'),
genus = c('Helianthus','Helianthus','Quercus','Poa','Festuca','Holodiscus'),
stringsAsFactors = FALSE)
(df2 <- taxon_df(df))
#> order family genus
#> 1 Asterales Asteraceae Helianthus
#> 2 Asterales Asteraceae Helianthus
#> 3 Fagales Fagaceae Quercus
#> 4 Poales Poaceae Poa
#> 5 Poales Poaceae Festuca
#> 6 Poales Poaceae HolodiscusParse - get rank order via pick()
df2 %>% pick(order)
#> order
#> 1 Asterales
#> 2 Asterales
#> 3 Fagales
#> 4 Poales
#> 5 Poales
#> 6 Poalesget ranks order, family, and genus via pick()
df2 %>% pick(order, family, genus)
#> order family genus
#> 1 Asterales Asteraceae Helianthus
#> 2 Asterales Asteraceae Helianthus
#> 3 Fagales Fagaceae Quercus
#> 4 Poales Poaceae Poa
#> 5 Poales Poaceae Festuca
#> 6 Poales Poaceae Holodiscusget range of names via span(), from rank X to rank Y
df2 %>% span(family, genus)
#> family genus
#> 1 Asteraceae Helianthus
#> 2 Asteraceae Helianthus
#> 3 Fagaceae Quercus
#> 4 Poaceae Poa
#> 5 Poaceae Festuca
#> 6 Poaceae HolodiscusSeparate each row into a taxon class (many taxon objects are a taxa class)
scatter(df2)
#> [[1]]
#> <taxon>
#> binomial: Helianthus none
#> grouping:
#> order: Asterales
#> family: Asteraceae
#> genus: Helianthus
#> species: Helianthus none
#>
#> [[2]]
#> <taxon>
#> binomial: Helianthus none
#> grouping:
#> order: Asterales
#> family: Asteraceae
#> genus: Helianthus
#> species: Helianthus none
#>
#> [[3]]
#> <taxon>
#> binomial: Quercus none
#> grouping:
#> order: Fagales
#> family: Fagaceae
#> genus: Quercus
#> species: Quercus none
#>
#> [[4]]
#> <taxon>
#> binomial: Poa none
#> grouping:
#> order: Poales
#> family: Poaceae
#> genus: Poa
#> species: Poa none
#>
#> [[5]]
#> <taxon>
#> binomial: Festuca none
#> grouping:
#> order: Poales
#> family: Poaceae
#> genus: Festuca
#> species: Festuca none
#>
#> [[6]]
#> <taxon>
#> binomial: Holodiscus none
#> grouping:
#> order: Poales
#> family: Poaceae
#> genus: Holodiscus
#> species: Holodiscus none
#>
#> attr(,"class")
#> [1] "taxa"And you can re-assemble a data.frame from the output of scatter() with assemble()
out <- scatter(df2)
assemble(out)
#> order family genus species
#> 1 Asterales Asteraceae Helianthus Helianthus none
#> 2 Asterales Asteraceae Helianthus Helianthus none
#> 3 Fagales Fagaceae Quercus Quercus none
#> 4 Poales Poaceae Poa Poa none
#> 5 Poales Poaceae Festuca Festuca none
#> 6 Poales Poaceae Holodiscus Holodiscus noneToDo
See our issue tracker to see what we have planned
Meta
- Please report any issues or bugs.
- License: MIT
- Get citation information for
binomenin R doingcitation(package = 'binomen') - Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.