Skip to content

Commit e7dd9b9

Browse files
add missing dataset flag
#413
1 parent b03e692 commit e7dd9b9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/get_muskrat_data.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ library(dplyr)
77
library(tidyr)
88
library(readr)
99

10+
datasets <- c("ddd51fa5-97ce-48ff-9a58-a09d7e76b103",
11+
"b7ee2a4d-8e10-410f-a951-a7f032678ffe",
12+
"95b0e787-8508-4247-9e48-18b45fc7d12e",
13+
"3634aee3-41d5-4aa2-8cb5-875859f62a3a",
14+
"69351197-880d-4100-8e69-e80babf3fdd7")
15+
1016
# Download data ####
1117
down_musk <- occ_download(
1218
pred("taxonKey", 5219858),
13-
pred_in("datasetKey", c("ddd51fa5-97ce-48ff-9a58-a09d7e76b103",
14-
"b7ee2a4d-8e10-410f-a951-a7f032678ffe",
15-
"95b0e787-8508-4247-9e48-18b45fc7d12e",
16-
"3634aee3-41d5-4aa2-8cb5-875859f62a3a",
17-
"69351197-880d-4100-8e69-e80babf3fdd7")),
19+
pred_in("datasetKey", datasets),
1820
format = "DWCA",
1921
user = Sys.getenv("gbif_user"),
2022
pwd = Sys.getenv("gbif_pwd"),
@@ -30,6 +32,9 @@ occ_download_wait(down_musk,
3032
raw_muskrat_data <- occ_download_get(down_musk) %>%
3133
occ_download_import()
3234

35+
# test if all datasets are present in the donwload
36+
testthat::expect_in(datasets, unique(raw_muskrat_data$datasetKey))
37+
3338
# Clean data ####
3439
table(raw_muskrat_data$datasetName,
3540
raw_muskrat_data$samplingProtocol,

0 commit comments

Comments
 (0)