tncvasconcelos / mvh

R package for assembling and organizing virtual herbaria
Other
3 stars 0 forks source link

mvh (My Virtual Herbarium)

The mvh R package helps you assemble and organize virtual herbaria. It provides functions to search for specimen metadata and download associated images from the GBIF dataset.

Installation

To install the package from GitHub, run:

devtools::install_github("tncvasconcelos/mvh")

Usage

Example 1: Search and Download Specimens

Search up to 8 specimens of the blueberry genus Vaccinium from the Ann Arbor, MI area and download the images.

# Search for specimen metadata
metadata <- search_specimen_metadata(
  taxon_name = "Vaccinium",
  coordinates = c(42.28, -83.74),
  limit = 8
)

# Download specimen images
download_specimen_images(
  metadata,
  dir_name = "Vaccinium_in_AnnArbor_example/specimens",
  result_file_name = "Vaccinium_in_AnnArbor_example/result_download"
)

Figure 1: Example output of a mvh pipeline to search and download up to eight specimens (“limit=8”) of the blueberry genus Vaccinium (Ericaceae) from the Ann Arbor (MI, USA) area (“coordinates = c(42.28, -83.74)”).

Example 2: Search and Plot Specimens

Search up to 100 specimens of Myrcia splendens and plot the number of specimens by institution and country.

# Search for specimen metadata
metadata <- search_specimen_metadata(
  taxon_name = "Myrcia splendens",
  limit = 100
)

# Plot data
pdf("plots_for_mvh_ms.pdf", height = 5, width = 10)
par(mfrow = c(1, 2))
plot_specimens_by_institution(metadata)
plot_specimens_by_country(metadata)
dev.off()

Figure 2: Example of a mvh pipeline to search up to 100 specimens (limit=”100”) of the widespread species Myrcia splendens (Myrtaceae) and plot the number of specimens per institution and country.

Function Details

Plotting Functions

The package mvh also includes two plotting functions to visualize components of the metadata associated with the search:

Both functions take the data.frame resulting from the search_specimen_metadata function and create bar plots in decreasing order of the number of specimens in each category.

Acknowledgments

Please remember to acknowledge the collections where the images come from if they are used in publications.