Functions included in this package allows users to painlessly connect to and extract data from EPPO Data Services / EPPO Global Database. Before you start using it you should register on: EPPO Data Services and obtain your token to access REST API.
You can install and use pestr
development version from
GitHub as follows:
::install_github("mczyzj/pestr") devtools
Package include function that allow you to download SQLite
database eppo_database_download
(archive around 12 MB,
after extraction around 45 MB). The database is needed for extracting
eppocodes that are used in other functions from this package. Function
included in eppo_tabletools_
family return both:
Before using functions that connect to REST API (hosts,
categorization, taxonomy and pests) you should execute
create_eppo_token
function with string argument equal to
your personal EPPO Data Services token. This function creates global
variable eppo_token
which should be parsed as an argument
to functions that require token
argument.
eppo_table_full
allow to execute all the functions and
return compact table with information on names, hosts, categorization,
distribution and taxonomy – one row per one pest.
Feel free to contribute to this package and report issues via GitHub or email.
First you need to create token variable, use your token from EPPO Data Services.
create_eppo_token('<<your token>>')
Than:
eppo_database_download()
eppo_database_download() #by default it downloads to working directory
#you can override this behaviour filepath argument
and extract the file manually to project working directory.
Put all the names that you are looking for into a vector, e.g.:
<- c(''Xylella', Cydia packardi', 'Drosophila suzuki') pests
and make connection to database.
<- eppo_database_connect() eppo_SQLite
Get pest names using:
<- eppo_names_tables(pests, eppo_SQLite) pests_names_tables
in result you will have list containing 4 tables:
data frame
with names that are present in EPPO
Data Services;data frame
with names that are not present EPPO
Data Services;data frame
with preferred names and eppo codes
EPPO Data Services;data frame
with all associated names to eppocode from
third data frame
.You might parse results of this function directly to
eppo_tabletools_
to obtain data. Other way is to use
raw eppocodes as argument (this workflow is explained in
Vignettes).
Using:
<- eppo_tabletools_cat(pests_names_tables, eppo_token) pests_cat
you will get as result you will get list with two elements:
data frame
with categorization tables for each eppocode
in long format;data frame
with categorization for each
eppocode condensed into a single cell.<- eppo_tabletools_hosts(pests_names_tables, eppo_token) pests_hosts
result with two tables:
data frame
in long format with all data for
all pests;data frame
where hosts are combined into
single cell for each eppocode.To get taxonomy use:
<- eppo_tabletools_taxo(pests_names_tables, eppo_token) pests_taxo
This function results are a list of two data frames
:
The function extracting distribution from EPPO Global
Database does not need eppo_token
. It can be
called like:
<- eppo_tabletools_distri(pests_names_tables) pest_distri
The result is a two element list:
data frame
of distribution in long
format;Whole condensed table in one shot:
<- eppo_table_full(pests, eppo_SQLite, eppo_token) eppo_fulltable
which you can easily save as csv and use in a spreadsheet:
write.csv(eppo_fulltable, 'eppo_fulltable.csv')
Since the EPPO Data Services provides information on pest of particular host, you can easily access information with:
<- c("Abies alba", "Triticum")
hosts
<- eppo_names_tables(pests, eppo_SQLite)
hosts_names_tables <- eppo_tabletools_taxo(hosts_names_tables, eppo_token) hosts_pests
TODO: