Learn R Programming

binomen (version 0.1.2)

pop: Pop names out

Description

That is, drop them

Usage

pop(.data, ...)

Arguments

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

Value

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

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')
## single taxonomic group
out %>% pop(family)
out %>% pop(genus)
out %>% pop(species)
## many taxonomic groups
out %>% pop(family, genus, species)

# 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))

## pop out a single taxonomic group
df2 %>% pop(order)
df2 %>% pop(family)
df2 %>% pop(genus)

## pop out many taxonomic groups
df2 %>% pop(order, family)
df2 %>% pop(order, genus)

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

Run the code above in your browser using DataLab