span: Parse taxon or taxondf objects by a range of names

Description Usage Arguments Value Examples

View source: R/span.R

Description

Parse taxon or taxondf objects by a range of names

Usage

1
span(.data, ...)

Arguments

.data

Input, object of class taxon

...

Pass in two unquoted taxonomic rank names, and only two. May make this more flexible in the future.

Value

A single or list of taxon class objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# operating on `taxon` objects
out <- make_taxon(genus="Poa", epithet="annua", authority="L.",
   family='Poaceae', clazz='Poales', kingdom='Plantae', variety='annua')
out %>% span(kingdom, genus)

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

## filter to get a range of classes
df2 %>% span(order, genus)
df2 %>% span(family, genus)

## from taxa object
df2 %>% scatter %>% span(family, species)

binomen documentation built on May 30, 2017, 7:38 a.m.