-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.Rhistory
512 lines (512 loc) · 19.8 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
devtools::load_all()
rm(goby_data)
data(goby_data)
goby_data$site_cov
goby_data$site_cov
usethis::use_data(goby_data)
devtools::load_all()
#' @srrstats {G5.2,G5.2b,BS2.15} Tests the assure function input checks are
#' behaving as expected.
#1. input tags are valid, q = FALSE, cov = FALSE
expect_error(joint_model(data = list(pcr.k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr.n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("Data should include 'pcr_n', 'pcr_k', and 'count'.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#2. input tags are valid, q = FALSE, cov = TRUE
site_cov <- cbind(c(1, 0), c(0.4, -0.4))
colnames(site_cov) <- c("var_a", "var_b")
expect_error(joint_model(data = list(pcr.k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr.n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site.cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste(paste0("Data should include 'pcr_n', 'pcr_k', ",
"'count', and 'site_cov'."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase2.html#prepare-the-data"),
sep = "\n"))
#3. input tags are valid, q = TRUE, cov = FALSE
expect_error(joint_model(data = list(pcr.k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr.n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count.type = rbind(c(1, 2, 1),
c(1, 2, NA))),
q = TRUE,
multicore = FALSE),
paste(paste0("Data should include 'pcr_n', 'pcr_k', ",
"'count', and 'count_type'."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#4. input tags are valid, q = TRUE, cov = TRUE
site_cov <- cbind(c(1, 0), c(0.4, -0.4))
colnames(site_cov) <- c("var_a", "var_b")
expect_error(joint_model(data = list(pcr.k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr.n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count.type = rbind(c(1, 2, 1),
c(1, 2, NA)),
site.cov = site_cov),
cov = c("var_a", "var_b"), q = TRUE,
multicore = FALSE),
paste(paste0("Data should include 'pcr_n', 'pcr_k', 'count', ",
"'count_type', and 'site_cov'."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#5. make sure dimensions of pcr_n and pcr_k are equal
#' @srrstats {BS2.1a} Test to ensure pre-processing routines to ensure all
#' input data is dimensionally commensurate
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1, 1),
c(1, 1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("Dimensions of pcr_n and pcr_k do not match.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#6. make sure dimensions of count and count_type are equal, if count_type is
# present
#' @srrstats {BS2.1a} Test to ensure pre-processing routines to ensure all
#' input data is dimensionally commensurate
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 2), c(1, 2))),
q = TRUE,
multicore = FALSE),
paste("Dimensions of count and count_type do not match.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#7. make sure number of rows in count = number of rows in pcr_n and pcr_k
#' @srrstats {BS2.1a} Test to ensure pre-processing routines to ensure all
#' input data is dimensionally commensurate
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA),
c(4, 1, 1))),
multicore = FALSE),
paste(paste0("Number of sites \\(rows\\) in pcr data and ",
"traditional survey count data do not match."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#8. make sure all data is numeric -- if q == TRUE
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c("NA", 2, 2),
c(1, 2, 2))),
q = TRUE,
multicore = FALSE),
paste("Data should be numeric.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#9. make sure all data is numeric -- if q == FALSE
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, "NA")),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("Data should be numeric.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#10. make sure locations of NAs in count data match locations of NAs in
# count_type data
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(NA, 2, 2),
c(1, 2, 2))),
q = TRUE,
multicore = FALSE),
paste(paste0("Empty data cells \\(NA\\) in count data should ",
"match ",
"empty data cells \\(NA\\) in count_type data."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#11. make sure locations of NAs in pcr_n data match locations of NAs in
# pcr_k data
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, NA, 1)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste(paste0("Empty data cells \\(NA\\) in pcr_n data should ",
"match ",
"empty data cells \\(NA\\) in pcr_k data."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#12. make sure family is either "poisson", "negbin", or "gamma"
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
family = "normal",
multicore = FALSE),
paste0("Invalid family. Options include 'poisson', ",
"'negbin', and 'gamma'."))
#13. p10 priors is a vector of two numeric values
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
p10_priors = c(1, 1, 2),
multicore = FALSE),
paste0("p10_priors should be a vector of two positive numeric ",
"values. ex. c\\(1,20\\)"))
#14. p10 priors is a vector of two numeric values
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE,
p10_priors = "1,20"),
paste0("p10_priors should be a vector of two positive numeric ",
"values. ex. c\\(1,20\\)"))
#15. p10 priors is a vector of two numeric values
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
p10_priors = c(0, 20),
multicore = FALSE),
paste0("p10_priors should be a vector of two positive numeric ",
"values. ex. c\\(1,20\\)"))
#16. phi priors is a vector of two numeric values
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
phi_priors = c(0, 1), family = "negbin",
multicore = FALSE),
paste0("phi_priors should be a vector of two positive numeric ",
"values. ex. c\\(0.25,0.25\\)"))
#17. the smallest count_type is 1
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(0, 1, 2),
c(1, 2, NA))),
q = TRUE,
multicore = FALSE),
paste(paste0("The first gear type should be referenced as 1 in ",
"count_type. Subsequent gear types should be ",
"referenced 2, 3, 4, etc."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#18. count are integers
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4.1, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 1, 2),
c(1, 2, NA))),
q = TRUE, family = "negbin",
multicore = FALSE),
paste0("All values in count should be non-negative integers. ",
"Use family = 'gamma' if count is continuous."))
#19. pcr_n are integers
expect_error(joint_model(data = list(pcr_k = rbind(c(0.99, 1, 1),
c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 1, 2),
c(1, 2, NA))),
q = TRUE,
multicore = FALSE),
paste("All values in pcr_k should be non-negative integers.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#20. pcr_k are integers
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3.1, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 1, 2),
c(1, 2, NA))),
q = TRUE,
multicore = FALSE),
paste("All values in pcr_n should be non-negative integers.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#21. count_type are integers
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1.1, 1, 2),
c(1, 2, NA))),
q = TRUE,
multicore = FALSE),
paste("All values in count_type should be integers.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#22. site_cov is numeric, if present
site_cov <- cbind(c("high", "low"), c(0.4, -0.4))
colnames(site_cov) <- c("var_a", "var_b")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 2, 1),
c(1, 2, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"), q = TRUE,
multicore = FALSE),
paste("site_cov should be numeric.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#23. cov values match column names in site_cov
site_cov <- cbind(c(0, 1), c(0.4, -0.4))
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 2, 1),
c(1, 2, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"), q = TRUE,
multicore = FALSE),
paste(paste0("cov values should be listed in the column names ",
"of site_cov in the data."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#24. site_cov has same number of rows as pcr_n and count, if present
site_cov <- cbind(c(0, 1, 1), c(0.4, -0.4, 1))
colnames(site_cov) <- c("var_a", "var_b")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(1, 2, 1),
c(1, 2, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"), q = TRUE,
multicore = FALSE),
paste(paste0("The number of rows in site_cov matrix should ",
"match the number of rows in all other matrices."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#25. make sure count_type is not zero-length
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = matrix(NA, ncol = 3,
nrow = 0)),
q = TRUE,
multicore = FALSE),
paste("count_type contains zero-length data.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#26. make sure no column is entirely NA in count_type
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
count_type = rbind(c(4, 1, NA),
c(1, 1, NA))),
q = TRUE,
multicore = FALSE),
paste("count_type contains a column with all NA.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase3.html#prepare-the-data"),
sep = "\n"))
#27. make sure no column is entirely NA in pcr_k
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, NA), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("pcr_k contains a column with all NA.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#28. make sure no column is entirely NA in pcr_n
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, NA), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("pcr_n contains a column with all NA.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#29. make sure no column is entirely NA in count
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, NA), c(1, 1, NA))),
multicore = FALSE),
paste("count contains a column with all NA.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#30. make sure no data are undefined
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, Inf),
c(1, 1, NA))),
multicore = FALSE),
paste("count contains undefined values \\(i.e., Inf or -Inf\\)",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#31. make sure no data are undefined
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, Inf), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("pcr_n contains undefined values \\(i.e., Inf or -Inf\\)",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#32. make sure no data are undefined
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, Inf), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA))),
multicore = FALSE),
paste("pcr_k contains undefined values \\(i.e., Inf or -Inf\\)",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app",
"/usecase1.html#prepare-the-data"),
sep = "\n"))
#33. make sure site_cov is not zero-length
site_cov <- matrix(NA, ncol = 2, nrow = 0)
colnames(site_cov) <- c("var_a", "var_b")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste("site_cov contains zero-length data.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#34a. make sure there are no NA in site_cov
site_cov <- rbind(c(4, 1, 0), c(1, 1, NA))
colnames(site_cov) <- c("var_a", "var_b", "var_c")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste("site_cov should not contain missing values (i.e., NA).",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste("site_cov should not contain missing values ",
"\\(i.e., NA\\).",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste("site_cov should not contain missing values \\(i.e., NA\\).",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste(paste0("site_cov should not contain missing values ",
"\\(i.e., NA\\)."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#34b. make sure no column is entirely NA in site_cov
site_cov <- rbind(c(4, 1, NA), c(1, 1, NA))
colnames(site_cov) <- c("var_a", "var_b", "var_c")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste("site_cov contains a column with all NA.",
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#35. make sure no data are undefined
site_cov <- rbind(c(4, 1, Inf), c(1, 1, NA))
#34. make sure there are no NA in site_cov
site_cov <- rbind(c(4, 1, 0), c(1, 1, NA))
colnames(site_cov) <- c("var_a", "var_b", "var_c")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste(paste0("site_cov should not contain missing values ",
"\\(i.e., NA\\)."),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#35. make sure no data are undefined
site_cov <- rbind(c(4, 1, Inf), c(1, 1, NA))
colnames(site_cov) <- c("var_a", "var_b", "var_c")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste(paste0("site_cov contains undefined values \\(i.e., ",
"Inf or -Inf\\)"),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))
#35. make sure no data are undefined
site_cov <- rbind(c(4, 1, Inf), c(1, 1, 1))
colnames(site_cov) <- c("var_a", "var_b", "var_c")
expect_error(joint_model(data = list(pcr_k = rbind(c(1, 1, 1), c(1, 1, NA)),
pcr_n = rbind(c(3, 3, 3), c(3, 3, NA)),
count = rbind(c(4, 1, 1), c(1, 1, NA)),
site_cov = site_cov),
cov = c("var_a", "var_b"),
multicore = FALSE),
paste(paste0("site_cov contains undefined values \\(i.e., ",
"Inf or -Inf\\)"),
"See the eDNAjoint guide for data formatting help: ",
paste0("https://ednajoint.netlify.app", "/usecase2.html"),
sep = "\n"))