| Title: | R Client for the BIODATACR Biodiversity Data Platform of Costa Rica |
|---|---|
| Description: | Provides functions to query occurrence records, species information, and datasets from BIODATACR <https://biodiversidad.go.cr>, the national biodiversity information platform of Costa Rica managed by the Technical Office of CONAGEBIO. Built on the Atlas of Living Australia (ALA) API infrastructure. |
| Authors: | Manuel Spinola [aut, cre] (ORCID: <https://orcid.org/0000-0002-7839-1908>) |
| Maintainer: | Manuel Spinola <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-07-22 20:09:27 UTC |
| Source: | https://github.com/cran/rbiodatacr |
Count occurrence records for a taxon
bdcr_count(taxon)bdcr_count(taxon)
taxon |
Character. Scientific name (e.g. '"Panthera onca"'). |
Integer with the total number of available records, or 'NA_integer_' if the service is unavailable.
## Not run: bdcr_count("Panthera onca") ## End(Not run)## Not run: bdcr_count("Panthera onca") ## End(Not run)
Count occurrence records for multiple taxa
bdcr_count_batch(taxa, wait = 1)bdcr_count_batch(taxa, wait = 1)
taxa |
Character vector. Scientific names. |
wait |
Numeric. Seconds to pause between requests. Default 1. |
A 'tibble' with columns 'taxon' and 'n_records'.
## Not run: spp <- c("Tapirus bairdii", "Panthera onca") bdcr_count_batch(spp) ## End(Not run)## Not run: spp <- c("Tapirus bairdii", "Panthera onca") bdcr_count_batch(spp) ## End(Not run)
Download occurrence records from BIODATACR
bdcr_occurrences(taxon, rows = 100, start = 0, page_size = 300, wait = 1)bdcr_occurrences(taxon, rows = 100, start = 0, page_size = 300, wait = 1)
taxon |
Character. Scientific name of the taxon. |
rows |
Integer. Maximum number of records to download. Default 100. Pass ‘Inf' (or the taxon’s true total, e.g. from [bdcr_count()]) to download every available record, paginating as needed. If fewer records are downloaded than actually exist, an informative message reports the true total so the result is never mistaken for the complete dataset. |
start |
Integer. Starting record for pagination. Default 0. |
page_size |
Integer. Records requested per HTTP call. Default 300. Kept below 'rows' and used to chunk large downloads into several polite requests instead of one giant one. |
wait |
Numeric. Seconds to pause between paginated requests (only relevant when more than one page is needed). Default 1. |
A 'tibble' with columns: 'scientificName', 'vernacularName', 'decimalLatitude', 'decimalLongitude', 'year', 'month', 'basisOfRecord', 'dataResourceName', 'country', 'family', 'species', 'collector', 'license', 'geospatialKosher', 'taxonomicKosher'. Returns an empty 'tibble' if the service is unavailable or no records are found.
## Not run: bdcr_occurrences("Panthera onca", rows = 50) bdcr_occurrences("Panthera onca") # primeros 100 (default) bdcr_occurrences("Panthera onca", rows = Inf) # todos los registros ## End(Not run)## Not run: bdcr_occurrences("Panthera onca", rows = 50) bdcr_occurrences("Panthera onca") # primeros 100 (default) bdcr_occurrences("Panthera onca", rows = Inf) # todos los registros ## End(Not run)
Download occurrence records for multiple taxa
bdcr_occurrences_batch(taxa, rows = 100, page_size = 300, wait = 1)bdcr_occurrences_batch(taxa, rows = 100, page_size = 300, wait = 1)
taxa |
Character vector. Scientific names. |
rows |
Integer. Maximum records per taxon. Default 100, matching [bdcr_occurrences()]. Pass 'Inf' to download every available record for each taxon; a message will report the true total for any taxon where the download is capped below it. |
page_size |
Integer. Records requested per HTTP call within each taxon's pagination. Default 300. |
wait |
Numeric. Seconds to pause between requests (both between taxa and between pages within a taxon). Default 1. |
Named list of tibbles, one per taxon. If the service is unavailable for a given taxon, the corresponding element will be an empty 'tibble'.
## Not run: spp <- c("Tapirus bairdii", "Panthera onca") bdcr_occurrences_batch(spp, rows = 50) bdcr_occurrences_batch(spp, rows = Inf) # descarga todos los registros ## End(Not run)## Not run: spp <- c("Tapirus bairdii", "Panthera onca") bdcr_occurrences_batch(spp, rows = 50) bdcr_occurrences_batch(spp, rows = Inf) # descarga todos los registros ## End(Not run)
Adds a 'quality_flag' column to an occurrence tibble. Requires that 'geospatialKosher' and 'taxonomicKosher' are logical — a condition guaranteed by 'bdcr_occurrences()'.
bdcr_quality_check(df, min_year = 1950)bdcr_quality_check(df, min_year = 1950)
df |
A 'tibble' of occurrence records (output of 'bdcr_occurrences()'). |
min_year |
Integer. Minimum acceptable year. Default 1950. |
The same 'tibble' with an additional 'quality_flag' column. Possible values:
No issues detected.
Missing coordinates.
'geospatialKosher == FALSE'.
'taxonomicKosher == FALSE'.
Year before 'min_year'.
## Not run: df <- bdcr_occurrences("Panthera onca", rows = 50) bdcr_quality_check(df) ## End(Not run)## Not run: df <- bdcr_occurrences("Panthera onca", rows = 50) bdcr_quality_check(df) ## End(Not run)
Queries the BIE (Biodiversity Information Explorer) index of BIODATACR to retrieve taxonomic information for a species.
bdcr_species_search(name, rows = 10)bdcr_species_search(name, rows = 10)
name |
Character. Scientific name (may be a synonym or partial name). |
rows |
Integer. Maximum number of results. Default 10. |
A 'tibble' with columns: 'name', 'guid', 'commonName', 'scientificName', 'rank', 'taxonomicStatus', 'nameComplete'. Returns an empty 'tibble' if the service is unavailable or no results are found.
## Not run: bdcr_species_search("Panthera onca") ## End(Not run)## Not run: bdcr_species_search("Panthera onca") ## End(Not run)
An 'sf' object with the national boundary of Costa Rica from GADM.
cr_outlinecr_outline
An 'sf' object with 1 row and the following columns:
Country code (CRI)
Country name
MULTIPOLYGON geometry