cites_shipments: CITES shipment data

View source: R/connect.R

cites_shipmentsR Documentation

CITES shipment data

Description

Returns a remote database table with all CITES shipment data. This is the bulk of the data in the package and constitutes > 20 million records. Loading the whole table into R via the dplyr::collect() command will use over 3 GB of RAM, so you may want to pre-process data in the database, as in the examples below.

Usage

cites_shipments()

Value

A dplyr remote tibble (dplyr::tbl())

Examples

if (cites_status()) {
  library(dplyr)

  # See the number of CITES shipment records per year
  cites_shipments() %>%
    group_by(Year) %>%
    summarize(n_records = n()) %>%
    arrange(desc(Year)) %>%
    collect()

  # See what pangolin shipments went to which countries in 1990
   cites_shipments() %>%
     filter(Order == "Pholidota", Year == 1990) %>%
     count(Year, Importer, Term) %>%
     collect() %>%
     left_join(select(cites_parties(), country, code),
               by = c("Importer" = "code"))

}

ropensci/citesdb documentation built on May 13, 2023, 1:53 a.m.