Learn R Programming

binomen (version 0.1.2)

pick: Pick names

Description

Pick names

Usage

pick(.data, ...)

Arguments

.data
Input, object of class taxon
...
Further unnamed args, see examples

Value

For taxon inputs, gives back a taxonref object. For taxondf inputs, gives back taxondf.

Examples

Run this code
# operating on `taxon` objects
out <- make_taxon(genus="Poa", epithet="annua", authority="L.",
   family='Poaceae', clazz='Poales', kingdom='Plantae', variety='annua')
out %>% pick(family)
out %>% pick(genus)
out %>% pick(species, genus)
out %>% pick(species) %>% name()
out %>% pick(species) %>% uri()

# operating on taxonomic data.frames
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'),
         stringsAsFactors = FALSE)
(df2 <- taxon_df(df))

## select single or many taxonomic classes
df2 %>% pick(order)
df2 %>% pick(family, genus)

# From taxa object
df2 %>% scatter %>% pick(family)
df2 %>% scatter %>% pick(family, species)
df2 %>% scatter %>% pick(family, species, genus)

Run the code above in your browser using DataLab