knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
r badger::badge_devel("special-uor/special.epd", "yellow")
r badger::badge_github_actions("special-uor/special.epd")
r badger::badge_cran_release("special.epd", "black")
The goal of special.epd
is to provide access to the SPECIAL Research group's version of the European Pollen Database (EPD).
You can(not) install the released version of special.epd
from CRAN with:
install.packages("special.epd")
And the development version from GitHub with:
# install.packages("remotes") remotes::install_github("special-uor/special.epd", "dev")
data("entity", package = "special.epd") data("date_info", package = "special.epd") data("sample", package = "special.epd") data("age_model", package = "special.epd") data("pollen_count", package = "special.epd")
The function special.epd::snapshot
takes few different parameters and based on
the first one, x
, it returns a variety of snapshots.
This function returns a list with 5 components:
entity
: data frame (tibble
object) with the metadata associated to the entities.date_info
: data frame (tibble
object) with the dating information. This one can be linked to the entity
table using the column called ID_ENTITY
.sample
: data frame (tibble
object) with the sampling information. This one can be linked to the entity
table using the column called ID_ENTITY
.age_model
: : data frame (tibble
object) with the "new" age models (created with ageR). This one can be linked to the sample
table using the column called ID_SAMPLE
.pollen_count
: list of data frames (tibble
objects) containing the pollen counts for 3 levels of "amalgamation":clean
intermediate
amalgamated
All these data frames can be linked to the sample
table using the column called ID_SAMPLE
.
:warning: NOTE: the output is returned "invisibly", so you should assign the output of the function to a variable.
output <- special.epd::snapshot(...) output$entity output$date_info output$sample output$pollen_count$clean output$pollen_count$intermediate output$pollen_count$intermediate
entity_name
special.epd::snapshot("MBA3")
site_name
special.epd::snapshot("Abant Golu", use_site_name = TRUE)
ID_ENTITY
special.epd::snapshot(2)
ID_SITE
special.epd::snapshot(3, use_id_site = TRUE)
special.epd::snapshot(1:10)
This will run very slow, so if only few entities are required, it would be better to indicate which, based on the previous examples.
out <- special.epd::snapshot()
The function special.epd::write_csvs
takes to parameters:
.data
: a list of class snapshot
, this one can be generated using the function special.epd::snapshot
(see previous section).prefix
: a prefix name to be included in each individual files, this prefix can include a relative or absolute path to a directory in the local machine.`%>%` <- special.epd::`%>%` special.epd::snapshot("MBA3") %>% special.epd::write_csvs(prefix = "MBA3")
paths <- list.files(pattern = "MBA3", full.names = TRUE) tree <- data.tree::as.Node(data.frame(pathString = paths)) data.tree::SetGraphStyle(tree, rankdir = "TB") data.tree::SetNodeStyle(tree, style = "filled,rounded", shape = "box") print(tree)
`%>%` <- special.epd::`%>%` special.epd::snapshot("MBA3") %>% special.epd::write_csvs(prefix = "/special.uor/epd/MBA3")
paths <- list.files(pattern = "MBA3", full.names = TRUE) %>% stringr::str_replace_all("./", "/special.uor/epd/") tree <- data.tree::as.Node(data.frame(pathString = paths)) data.tree::SetGraphStyle(tree, rankdir = "TB") data.tree::SetNodeStyle(tree, style = "filled,rounded", shape = "box") print(tree)
paths <- list.files(pattern = "MBA3", full.names = TRUE) unlink(paths)
`%>%` <- special.epd::`%>%` special.epd::entity %>% smpds::plot_climate(var = "elevation", units = "m ASL", ylim = c(25, 85), xlim = c(-30, 170))
Using the package smpds
[https://github.com/special-uor/smpds] we can extract the PNV for each entity and create a plot:
`%>%` <- special.epd::`%>%` special.epd_pnv <- special.epd::entity %>% smpds::extract_biome() # For a quicker execution special.epd_pnv <- special.epd::entity %>% smpds::parallel_extract_biome(cpus = 4) # Plot the PNV special.epd_pnv %>% smpds::plot_biome(ylim = c(25, 85), xlim = c(-30, 170))
`%>%` <- special.epd::`%>%` special.epd_pnv <- special.epd::entity %>% smpds::parallel_extract_biome(cpus = 12) # Plot the PNV special.epd_pnv %>% smpds::plot_biome(ylim = c(25, 85), xlim = c(-30, 170))
`%>%` <- special.epd::`%>%` special_epd_summary <- special.epd::db_summary() tibble::tibble( `# Entities` = nrow(special_epd_summary), `with Dates` = sum(special_epd_summary$has_DATES, na.rm = TRUE), `with Age models (using IntCal20)` = sum(special_epd_summary$has_AM, na.rm = TRUE), `with Pollen counts` = sum(special_epd_summary$has_COUNTS, na.rm = TRUE) ) %>% knitr::kable()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.