Pop names out

Share:

Description

That is, drop them

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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)