Hello,
I am a phd student and I tried to download occurrence data for 532 species in Sri Lanka using R studio. Even though codes are running the downland file does not contain any data except headings. I am really confused about this as I am new to R and Gbif. It would be grateful if you can help me to figure it out. I have pasted the code I used. Thank you in advance
GBIF_USER=“xxxxxxxx”
GBIF_PWD=“xxxxxxx”
GBIF_EMAIL=“[xxxxxxx)”
sltree = read.csv(“A:/Concordia research/Phylogeny tree/GBIF data/Tree list for gbif.csv”)
gbif_taxon_keys ← sltree %>%
name_backbone_checklist() %>% # match to backbone
filter(!matchType == “NONE”) %>% # get matched names
pull(usageKey)
occ_download(
pred_in(“taxonKey”,gbif_taxon_keys ),
pred_in(“basisOfRecord”, c(‘HUMAN_OBSERVATION’)),
pred(“country”, “Sri Lanka”),
pred(“hasCoordinate”, TRUE),
pred(“hasGeospatialIssue”, FALSE),
format = “SIMPLE_CSV”,
user=GBIF_USER,pwd=GBIF_PWD,email=GBIF_EMAIL)
What does this file look like? Do you have your species names in the first column?
Yes. It has species name in the first column.
@s_nawala Could you send me the link to your download?
Here you go.
Thank you
Hi @s_nawala
You should use the country code (LK) instead of the country name (“Sri Lanka”) which our system can’t recognise. I tried one of your queries with the country code and got some results: Download
Note that there are more records in the region for those species that are preserved specimen. Something to keep in mind when filtering for the basis of record.
Thank you so much. It worked.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.