# Load necessary packages
library(dplyr)
library(stringr)
library(tidyselect)
library(magrittr)
library(devtools)
Filter REFLORA specimen records
In this document we’ll demonstrate how to use the `reflora_occurrence` function, with different parameters, to retrieve specific taxon records from the REFLORA virtual herbariums.
Function Overview
The `reflora_occurrence` function retrieves specific taxon records from the REFLORA herbariums {https://ipt.jbrj.gov.br/reflora}{REFLORA , hosted by the Rio de Janeiro Botanical Garden {https://www.gov.br/jbrj}.
Installing and loading dependencies
To run the example, ensure that the function and any necessary packages are loaded in your R environment.
Installing the package remotely from the Github repository
#installing `refloraR`
::install_github("DBOSlab/refloraR")
devtoolslibrary(refloraR)
Example 1: Defining taxa and Herbarium
# Define taxa
<- c("Fabaceae")
fam_taxa <- c("ALCB") herbaria
Running the `reflora_occurrence` function. We assume that the dwca files, from the `reflora_download`, were already downloaded in the “download_reflora” file.
# Run the reflora_occurrence function with example parameters
<- reflora_occurrence(
example_1 herbarium = herbaria,
taxon = fam_taxa,
verbose = TRUE,
save = TRUE,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_1[,3:8]))
The function allows as input a vector with several taxa (families, genera and/or species) and herbariums
# Define example taxa and herbariums
<- c("Abarema", "Justicia")
fam_taxa <- c("ALCB", "HUEFS", "K") herbaria
Running the function
# Run the reflora_occurrence function with example parameters
<- reflora_occurrence(
example_1_1 herbarium = herbaria,
taxon = fam_taxa,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_1_1[,3:8]))
Example 2: Defining Record year
<- c("Guapira")
fam_taxa <- c("RB")
herbaria <- "2011" year_wanted
Running the function
# Run the reflora_occurrence function with example parameters
<- reflora_occurrence(
example_2 herbarium = herbaria,
taxon = fam_taxa,
recordYear = year_wanted,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_2[,3:8]))
The function also allows a record year spam
<- c("Nyctaginaceae", "Ochnaceae")
fam_taxa <- c("HUCP", "MUFAL")
herbaria <- c("2011", "2015") years_wanted
Running the function
# Run the reflora_occurrence function with the recordYear spam
<- reflora_occurrence(
example_2_1 herbarium = herbaria,
taxon = fam_taxa,
recordYear = years_wanted,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_2_1[,3:8]))
Example 3: Defining the Brazilian state
<- c("Acanthaceae")
fam_taxa <- c("RB")
herbaria <- "2011"
year_wanted <- c("Bahia") Br_state
Running the function
# Run the reflora_occurrence function with the Brazilian state
<- reflora_occurrence(
example_3 herbarium = herbaria,
taxon = fam_taxa,
recordYear = year_wanted,
state = Br_state,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_3[,3:8]))
The function also allows as input the Brazilian states’ acronyms and a vector with states
<- c("Fabaceae", "Nyctaginaceae")
fam_taxa <- c("RB", "PEL")
herbaria <- c("2013", "2018")
year_wanted <- c("Bahia", "SP") #BA = Bahia; SP = São Paulo Br_acronyms
Running ‘reflora_occurrence’
# Run the reflora_occurrence function with the recordYear spam
<- reflora_occurrence(
example_3_1 herbarium = herbaria,
taxon = fam_taxa,
recordYear = year_wanted,
state = Br_acronyms,
path = "download_reflora",
dir = "reflora_occurrence",
filename = "reflora_occurrence_search"
)
# Display the result
print(head(example_3_1[,3:8]))