# Create tables for EPPO Pest Risk Assessment

    ### Load packages
    library("pestr")
    library("dplyr")

# Overview

EPPO Express Pest Risk Analysis – PM5/5(1) Additional guidance – requires information that can be easily obtained using `pestr` package functions. Particularly the information needed for Stage 2. Pest Risk Assessment:

- 1. Taxonomy – `eppo_tabletools_taxo`, `eppo_names_tables`
- 2. Pest overview – `eppo_tabletools_hosts`
- 5. Regulatory status of the pest – `eppo_tabletools_cat`
- 6. Distribution – `eppo_tabletools_distri`
- 7. Host plants / habitats and their distribution in the PRA area – `eppo_tabletools_hosts`

For the purpose of this vignette, lets assume that you are working on well known pest – Anoplophora chinensis. This beetle is know for it’s voracious larvae which bore into the wood of living trees. More detailed info can be found at EPPO Datasheet: Anoplophora chinensis.

Please bear in mind that the workflow presented in this vignette can be also adjusted to other Pest Risk Analyses / Assessments of other authorities with some basic knowledge on `R` tools like `dplyr`, `tidyr` or `stringr`.

Prior to downloading data, please ensure that you set up variables.

    ### assign token to variable
    eppo_token <- create_eppo_token("<<your eppo token>>")
    ### assign name to variable
    ac_name <- "Anoplophora chinensis"
    ### assign eppocode to variable
    ac_eppocode <- "ANOLCN"
    ### assign database connection to variable
    eppoDB <- eppo_database_connect()

## Taxonomy and names of pest

    ac_names_table <- eppo_names_tables(ac_name, eppo_DB)

    ac_other_names <- eppo_tabletools_names(ac_names_table) %>%
      .[2] %>%
      dplyr::select(Other_names) %>%
      unlist()

    ac_taxonomy <- eppo_tabletools_taxo(
      token = eppo_token,
      raw_eppocodes = ac_eppocode,
      use_raw_codes = TRUE
      )

## Host of pest – as text or as table

    ac_hosts <- eppo_tabletools_hosts(
      token = eppo_token,
      raw_eppocodes = ac_eppocode,
      use_raw_codes = TRUE
      )

## Categorization table

    ac_categorization <- eppo_tabletools_cat(
      token = eppo_token,
      raw_eppocodes = ac_eppocode,
      use_raw_codes = TRUE
      )

## Distribution of pest

    ac_distribution <- eppo_tabletools_distri(
      token = eppo_token,
      raw_eppocodes = ac_eppocode,
      use_raw_codes = TRUE
      )