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.
To install the package from GitHub, run:
devtools::install_github("tncvasconcelos/mvh")
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"
)
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()
search_specimen_metadata
:
taxon_name
: Scientific name of the species.coordinates
: Latitude and longitude for geography-based searches.buffer_distance
: Size of the geographic search area.rgbif::occ_search
arguments are supported.download_specimen_images
:
media_url
column of the metadata.dir_name
: Directory name for saving images.result_file_name
: Name of the results spreadsheet.resize
: Resize images to a percentage of the original size (1-100).timeout_limit
: Time in seconds to wait before a download fails.The package mvh
also includes two plotting functions to visualize components of the metadata associated with the search:
plot_specimens_by_country
: Displays a bar plot showing the number of specimens collected in each country.plot_specimens_by_institution
: Displays a bar plot showing the number of specimens deposited in each institution, often following herbarium acronyms according to Thiers (continuously updated).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.
Please remember to acknowledge the collections where the images come from if they are used in publications.