library(rgbif)
library(dplyr)Data retrieval
Data retrieval from Global Biodiversity Information Facility (GBIF)
Records of herbarium specimens of flowering plants collected in Guyana, Suriname, or French Guiana were retrieved from the GBIF.
Code
Load libraries:
Retrieve data:
# gbif_download <- occ_download(
# pred_in("country", countries),
# pred("taxonKey", "7707728"), # aNGIOSPERMS
# pred("basisOfRecord", "PRESERVED_SPECIMEN"),
# #pred("kingdom", "Plantae"),
# #pred("phylum", "Tracheophyta"),
# #pred("class", "Magnoliopsida"),
# pred("hasGeospatialIssue", FALSE),
# pred("hasCoordinate", TRUE),
# format = "SIMPLE_CSV",
# user = "YOUR USER NAME HERE",
# pwd = "YOUR PASSWORD HERE",
# email = "YOUR EMAIL HERE")
#
# # Wait for the download to finish
# occ_download_wait(gbif_download)
# Get download from GBIF into R:
# Get the download from GBIF
res <- occ_download_get(key="0000200-260129131611470", path= "../Data/GBIF", overwrite=TRUE)
# Import the data into R
gbif_Guianas<-occ_download_import(res)
totals<-gbif_Guianas %>%
group_by(family) %>%
summarise(N_genus = n_distinct(genus))
head(totals)# A tibble: 6 × 2
family N_genus
<chr> <int>
1 "" 2
2 "Acanthaceae" 24
3 "Achariaceae" 5
4 "Aizoaceae" 1
5 "Alismataceae" 7
6 "Alstroemeriaceae" 1