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.

# Load necessary packages
library(dplyr)
library(stringr)
library(tidyselect)
library(magrittr)
library(devtools)

Installing the package remotely from the Github repository

#installing `refloraR`
devtools::install_github("DBOSlab/refloraR")
library(refloraR)

Example 1: Defining taxa and Herbarium

# Define taxa
fam_taxa <- c("Fabaceae")
herbaria <- c("ALCB")

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
example_1 <- reflora_occurrence(
  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
fam_taxa <- c("Abarema", "Justicia")
herbaria <- c("ALCB", "HUEFS", "K")

Running the function

# Run the reflora_occurrence function with example parameters
example_1_1 <- reflora_occurrence(
  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

fam_taxa <- c("Guapira")
herbaria <- c("RB")
year_wanted <- "2011"

Running the function

# Run the reflora_occurrence function with example parameters
example_2 <- reflora_occurrence(
  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

fam_taxa <- c("Nyctaginaceae", "Ochnaceae")
herbaria <- c("HUCP", "MUFAL")
years_wanted <- c("2011", "2015")

Running the function

# Run the reflora_occurrence function with the recordYear spam
example_2_1 <- reflora_occurrence(
  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

fam_taxa <- c("Acanthaceae")
herbaria <- c("RB")
year_wanted <- "2011"
Br_state <- c("Bahia")

Running the function

# Run the reflora_occurrence function with the Brazilian state
example_3 <- reflora_occurrence(
  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

fam_taxa <- c("Fabaceae", "Nyctaginaceae")
herbaria <- c("RB", "PEL")
year_wanted <- c("2013", "2018")
Br_acronyms <- c("Bahia", "SP") #BA = Bahia; SP = São Paulo

Running ‘reflora_occurrence’

# Run the reflora_occurrence function with the recordYear spam
example_3_1 <- reflora_occurrence(
  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]))