Skip to content

Instantly share code, notes, and snippets.

@PietrH
Created January 24, 2024 13:56
Show Gist options
  • Save PietrH/8256a415f48039378f7aeeee604a3664 to your computer and use it in GitHub Desktop.
Save PietrH/8256a415f48039378f7aeeee604a3664 to your computer and use it in GitHub Desktop.
Check if a species has an occurrence in Belgium using rgbif
library(dplyr)
check_presence <-
function(scientificName = c('Vulpes vulpes', 'Pica pica'),
country = "BE") {
purrr::map(
scientificName,
~ rgbif::occ_data(
scientificName = .x,
country = country,
limit = 1
)$data
) %>%
purrr::map_lgl( ~ nrow(.x) >= 1) %>%
tibble(present = ., scientificName = scientificName)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment