pd_biodiv: Gather biodiversity records

Description Usage Arguments Value Examples

View source: R/pd_biodiv.R

Description

Gather biodiversity records

Usage

1
pd_biodiv(x, db = "gbif", type = "count", by = NULL, ...)

Arguments

x

an object of class 'phylodiv'

db

(character) the database to use to get taxonomic information. only option is "gbif" for now

type

(character) one of count or facet

by

(character) only used if 'type = "by"'. one of country, ...

...

further args passed on to [rgbif::occ_data()]

Value

an object of class 'phylodiv', a named list with slots:

- tree - tips - nodes - hierarchies - data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
x <- pd_read(st)
res <- pd_taxa(x)
spp <- c("Eptesicus serotinus", "Eptesicus fuscus",
  "Eptesicus furinalis", "Eptesicus brasiliensis")
res <- pd_query(res, spp)

# facet data: e.g., facet on country
biodiv <- pd_biodiv(res, type = 'facet', by = "country")
biodiv
biodiv$data

# count data
counts <- pd_biodiv(res, type = 'count')
counts
counts$data
counts$data$count

## End(Not run)

ropensci/phylodiv documentation built on March 13, 2020, 3:14 p.m.