forked from NIWAFisheriesModelling/r4Casal2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 21.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
## Complex
summarise_config = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
summarise_config
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
expect_false(inherits(test, "error"))
testthat::announce_snapshot_file()expect_false(inherits(test, "error"))
testthat::expect_false(inherits(test, "error"))
getwd()
config_dir
config_file = "config.csl2"
quiet = T
fileEncoding = ""
if (!file.exists(file.path(config_dir, config_file)))
stop(paste0("Could not find ", config_file, " at ", config_dir))
config_file_in = scan(file = file.path(config_dir, config_file),
what = "", sep = "\n", quiet = T)
###################################################
config_file_in <- StripComments(config_file_in)
include_lines = grepl(pattern = "!include", config_file_in)
config_file_in = config_file_in[include_lines]
config_file_in = substring(config_file_in, first = 10)
ndx = regexpr("\"", config_file_in) > 0
if (any(ndx)) {
for (i in 1:length(config_file_in)) {
if (ndx[i])
config_file_in[i] <- do.call(file.path, gsub("\"| ","", config_file_in[i]) %>% str_split(pattern = "/") %>% unlist() %>% as.list())
# config_file_in[i] = substring(config_file_in[i],
# first = 2, last = nchar(config_file_in[i]) -
# 1)
}
}
if (!quiet)
cat("found the following files to read in ", config_file_in,
"\n")
model_block = list()
observation_blocks = list()
derived_quantity_blocks = list()
process_blocks = list()
estimate_blocks = list()
time_steps_list = list()
categories_list = list()
age_length_list = list()
length_weight_list = list()
growth_list = list()
category_labels = NULL
observation_labels = NULL
category_age_lengths = NULL
category_growth_increments = NULL
category_format = NULL
model_years = NULL
model_length_bins = NULL
ages = NULL
time_steps = NULL
length_based_model = F
for (i in 1:length(config_file_in)) {
if (!file.exists(file.path(config_dir, config_file_in[i])))
cat("couldn't find file = ", file.path(config_dir,
config_file_in[i]))
# this_file = tryCatch(extract.csl2.file(path = config_dir,
# file = config_file_in[i], quiet = quiet), error = function(e) {
# e
# }, warning = function(w) {
# w
# })
this_file = tryCatch(extract.csl2.file(file = file.path(config_dir, config_file_in[i]), quiet = quiet), error = function(e) {
e
}, warning = function(w) {
w
})
# test <- extract.csl2.file(file = file.path(config_dir, config_file_in[i]), quiet=TRUE)
if (inherits(this_file, "error") | inherits(this_file,
"warning")) {
cat("failed to readin the following file ", config_file_in[i],
" so skipping it.\n\nthe error\n", this_file$message,
"\n")
next
}
blocks = get_block(names(this_file))
labels = get_label(names(this_file))
for (j in 1:length(this_file)) {
if (tolower(blocks[j]) == "model") {
if (is.null(this_file[[j]]$type)) {
length_based_model = FALSE
}
else {
if (this_file[[j]]$type$value == "length") {
length_based_model = TRUE
}
else {
length_based_model = FALSE
}
}
model_block[["model"]] = this_file[[j]]
model_years = as.numeric(this_file[[j]]$start_year$value):as.numeric(this_file[[j]]$final_year$value)
if (!is.null(this_file[[j]]$min_age))
ages = as.numeric(this_file[[j]]$min_age$value):as.numeric(this_file[[j]]$max_age$value)
time_steps = this_file[[j]]$time_steps$value
if (!is.null(this_file[[j]]$length_bins)) {
for (k in 1:length(this_file[[j]]$length_bins$value)) model_length_bins = c(model_length_bins,
expand_shorthand_syntax(syntax = this_file[[j]]$length_bins$value[k]))
}
}
else if (tolower(blocks[j]) == "time_step") {
time_steps_list[[labels[j]]] = this_file[[j]]$processes$value
}
else if (tolower(blocks[j]) == "categories") {
for (k in 1:length(this_file[[j]]$names$value)) {
category_labels = c(category_labels, expand_category_block(categories = this_file[[j]]$names$value[k]))
}
if (!is.null(this_file[[j]]$age_lengths)) {
for (k in 1:length(this_file[[j]]$age_lengths$value)) {
category_age_lengths = c(category_age_lengths,
expand_shorthand_syntax(syntax = this_file[[j]]$age_lengths$value[k]))
}
}
if (!is.null(this_file[[j]]$growth_increment)) {
for (k in 1:length(this_file[[j]]$growth_increment$value)) {
category_growth_increments = c(category_growth_increments,
expand_shorthand_syntax(syntax = this_file[[j]]$growth_increment$value[k]))
}
}
if (!is.null(this_file[[j]]$format)) {
category_format = this_file[[j]]$format$value
category_format <- str_split(category_format, "\\.") %>% unlist()
category_labels_withFormat <- as_tibble(category_labels) %>%
rename(label = value) %>%
separate(label, into =category_format, remove = FALSE)
}
}
else if (tolower(blocks[j]) == "age_length") {
age_length_list[[labels[j]]] = this_file[[j]]
}
else if (tolower(blocks[j]) == "growth_increment") {
growth_list[[labels[j]]] = this_file[[j]]
}
else if (tolower(blocks[j]) == "process") {
process_blocks[[labels[j]]] = this_file[[j]]
}
else if (tolower(blocks[j]) == "length_weight") {
length_weight_list[[labels[j]]] = this_file[[j]]
}
else if (tolower(blocks[j]) == "estimate") {
estimate_blocks[[labels[j]]] = this_file[[j]]
}
else if (tolower(blocks[j]) == "observation") {
observation_blocks[[labels[j]]] = this_file[[j]]
observation_labels = c(observation_labels, labels[j])
}
else if (tolower(blocks[j]) == "derived_quantity") {
derived_quantity_blocks[[labels[j]]] = this_file[[j]]
}
}
}
category_df = full_category_df = NULL
age_length_time_step_growth = NULL
for (i in 1:length(category_labels)) {
if (!length_based_model) {
this_age_length = age_length_list[[category_age_lengths[i]]]
this_length_weight = length_weight_list[[this_age_length$length_weight$value]]
distribution = "normal"
if (!is.null(this_age_length$distribution))
distribution = this_age_length$distribution
this_cat_df = data.frame(Category = category_labels[i],
AgeLength = category_age_lengths[i], LengthWeight = this_age_length$length_weight$value,
Distribution = distribution)
this_cat_full_df = data.frame(Category = category_labels[i],
AgeLength = paste0(category_age_lengths[i], " (",
this_age_length$type$value, ")"), LengthWeight = paste0(this_age_length$length_weight$value,
" (", this_length_weight$type$value, ")"),
Distribution = distribution)
category_df = rbind(category_df, this_cat_df)
if (is.null(this_age_length$time_step_proportions$value))
this_age_length$time_step_proportions$value = 0
full_category_df = rbind(full_category_df, this_cat_full_df)
if (is.null(age_length_time_step_growth))
age_length_time_step_growth = rbind(age_length_time_step_growth,
data.frame(AgeLength = category_age_lengths[i],
time_step_proportions = this_age_length$time_step_proportions$value))
if (!category_age_lengths[i] %in% age_length_time_step_growth$AgeLength)
age_length_time_step_growth = rbind(age_length_time_step_growth,
data.frame(AgeLength = category_age_lengths[i],
time_step_proportions = this_age_length$time_step_proportions$value))
}
else {
this_growth = growth_list[[category_growth_increments[i]]]
this_length_weight = length_weight_list[[this_growth$length_weight$value]]
distribution = list(value = "normal")
if (!is.null(this_growth$distribution))
distribution = this_growth$distribution$value # edit to return value
this_cat_df = data.frame(Category = category_labels[i],
GrowthIncrement = category_growth_increments[i],
LengthWeight = this_growth$length_weight$value,
Distribution = distribution)
this_cat_full_df = data.frame(Category = category_labels[i],
GrowthIncrement = paste0(category_growth_increments[i],
" (", this_growth$type$value, ")"), LengthWeight = paste0(this_growth$length_weight$value,
" (", this_length_weight$type$value, ")"),
Distribution = distribution)
category_df = rbind(category_df, this_cat_df)
full_category_df = rbind(full_category_df, this_cat_full_df)
if (is.null(age_length_time_step_growth)) # edit for is.null timestep proportions for growth increment. defaulting to 1
age_length_time_step_growth = rbind(age_length_time_step_growth,
data.frame(GrowthIncrement = category_growth_increments[i],
time_step_proportions = ifelse(is.null(this_growth$time_step_proportions$value), 1, this_growth$time_step_proportions$value)))
if (!category_growth_increments[i] %in% age_length_time_step_growth$GrowthIncrement) # edit for is.null timestep proportions for growth increment. defaulting to 1
age_length_time_step_growth = rbind(age_length_time_step_growth,
data.frame(GrowthIncrement = category_growth_increments[i],
time_step_proportions = ifelse(is.null(this_growth$time_step_proportions$value), 1, this_growth$time_step_proportions$value)))
}
}
# if(!is.null(category_labels_withFormat)){
category_df <- category_df %>%
as_tibble() %>%
left_join(category_labels_withFormat, by = c("Category" = "label"))
# }
obs_year_df = NULL
if (!is.null(observation_labels)) {
for (i in 1:length(observation_labels)) {
this_obs = observation_blocks[[observation_labels[i]]]
years = NULL
for (y in 1:length(this_obs$years$value)) {
years = c(years, expand_shorthand_syntax(this_obs$years$value[y]))
}
active_ndx = model_years %in% years
obs_year_df = rbind(obs_year_df, data.frame(year = model_years,
observation = observation_labels[i], type = this_obs$type$value,
active = ifelse(active_ndx, 1, NA)))
}
}
time_step_df = NULL
time_step_df_just_lab = NULL
for (i in 1:length(time_steps)) {
proceses = time_steps_list[[time_steps[i]]]
process_type = vector()
df_entry = vector()
for (j in 1:length(proceses)) {
process_type[j] = process_blocks[[proceses[j]]]$type$value
df_entry[j] = paste0(proceses[j], " (", process_type[j],
")")
}
for (j in 1:length(derived_quantity_blocks)) {
if (time_steps[i] == derived_quantity_blocks[[j]]$time_step$value) {
prop_mortality = 0.5
if (exists(x = "time_step_proportion", where = derived_quantity_blocks[[j]])) {
prop_mortality = as.numeric(derived_quantity_blocks[[j]]$time_step_proportion$value)
}
process_type = c(process_type, "derived-quantity")
df_entry = c(df_entry, paste0(names(derived_quantity_blocks)[j],
" (derived-quantity ", round(prop_mortality,
2), ")"))
}
}
this_step = data.frame(time_step = time_steps[i], processes = paste(df_entry,
collapse = ", "))
time_step_df = rbind(time_step_df, this_step)
time_step_df_just_lab = rbind(time_step_df_just_lab,
data.frame(time_step = time_steps[i], processes = paste(proceses,
collapse = ", ")))
}
if (!length_based_model) {
age_length_labs = unique(age_length_time_step_growth$AgeLength)
for (i in 1:length(age_length_labs)) {
this_growth = age_length_time_step_growth[which(age_length_time_step_growth$AgeLength ==
age_length_labs[i]), ]
time_step_df = cbind(time_step_df, this_growth$time_step_proportions)
time_step_df_just_lab = cbind(time_step_df_just_lab,
this_growth$time_step_proportions)
}
age_length_labs = paste0(age_length_labs, " (assumed growth)")
colnames(time_step_df_just_lab) = c("Time-step", "Processes",
age_length_labs)
colnames(time_step_df) = c("Time-step", "Processes (type)",
age_length_labs)
} else {
age_length_labs = unique(age_length_time_step_growth$GrowthIncrement)
for (i in 1:length(age_length_labs)) {
this_growth = age_length_time_step_growth[which(age_length_time_step_growth$GrowthIncrement ==
age_length_labs[i]), ]
time_step_df = cbind(time_step_df, this_growth$time_step_proportions)
time_step_df_just_lab = cbind(time_step_df_just_lab,
this_growth$time_step_proportions)
}
age_length_labs = paste0(age_length_labs, " (assumed growth)")
colnames(time_step_df_just_lab) = c("Time-step", "Processes",
age_length_labs)
colnames(time_step_df) = c("Time-step", "Processes (type)",
age_length_labs)
}
M_by_category = NULL
M_time_steps = NULL
catch_df = NULL
method_df = NULL
for (i in 1:length(process_blocks)) {
this_process = process_blocks[[i]]
if (tolower(this_process$type$value) == "mortality_instantaneous") {
m = expand_shorthand_syntax(this_process$m$value)
categories = NULL
for (j in 1:length(this_process$categories$value)) categories = c(categories,
expand_category_shorthand(shorthand_categories = this_process$categories$value[j],
reference_categories = category_labels, category_format = category_format))
selectivty = NULL
for (j in 1:length(this_process$relative_m_by_age$value)) selectivty = c(selectivty,
expand_shorthand_syntax(this_process$relative_m_by_age$value[j]))
M_by_category = rbind(data.frame(process = names(process_blocks)[i],
category = categories, M = m, relative_M = selectivty))
time_prop = NULL
if (is.null(this_process$time_step_proportions$value)) {
time_prop = rep(1, nrow(time_step_df))
}
else {
time_prop = this_process$time_step_proportions$value
}
M_time_steps = rbind(M_time_steps, data.frame(process = names(process_blocks)[i],
time_step_proportions = time_prop))
if (!is.null(this_process$Table$catches)) {
this_catch = Reduce(cbind, this_process$Table$catches)
class(this_catch) = "numeric"
colnames(this_catch) = names(this_process$Table$catches)
this_catch = as.data.frame(this_catch)
this_catch$process = names(process_blocks)[i]
# molten_catch = melt(this_catch, id.vars = c("year",
# "process"), value.name = "catch", variable.name = "fishery")
## CHANGED from using melt as it's no longer a supported function
molten_catch <- this_catch %>%
pivot_longer(cols = -c(year, process)) %>%
rename(catch = value, fishery = name) %>%
mutate(fishery = as.factor(fishery)) %>%
arrange(fishery, year)
##
catch_df = rbind(catch_df, molten_catch)
this_method = Reduce(cbind, this_process$Table$method)
colnames(this_method) = names(this_process$Table$method)
this_method = as.data.frame(this_method, stringsAsFactors = F)
for (k in 1:nrow(this_method)) this_method$category[k] = paste(expand_category_shorthand(this_method$category[k],
category_labels, category_format = category_format),
collapse = ",")
this_method$process = names(process_blocks)[i]
method_df = rbind(method_df, this_method)
}
}
else if (tolower(this_process$type$value) == "mortality_instantaneous_retained") {
print("not yet implemented for mortality_instantaneous_retained")
}
}
estimate_df = NULL
if (length(estimate_blocks) > 0) {
for (i in 1:length(estimate_blocks)) {
this_estimate = estimate_blocks[[i]]
label = names(estimate_blocks)[i]
parameter = this_estimate$parameter$value
type = this_estimate$type$value
lower_bound = this_estimate$lower_bound$value
upper_bound = this_estimate$upper_bound$value
same = this_estimate$save$value
if (!is.null(same)) {
if (length(same) > 1) {
same = paste(same, collapse = ", ")
}
}
else {
same = "-"
}
if (length(lower_bound) > 1) {
lower_bound = paste(lower_bound, collapse = " ")
}
if (length(upper_bound) > 1) {
upper_bound = paste(upper_bound, collapse = " ")
}
this_df = data.frame(label = label, same = same,
prior = type, lower_bound = lower_bound, upper_bound = upper_bound)
estimate_df = rbind(estimate_df, this_df)
}
}
catch_df
method_df
?tryCatch
?tryCatch
tryCatch(1, finally = print("Hello"))
library(testthat)
test_data_dir = file.path("..","..","inst","testdata")
## Complex
summarise_config = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e) e)
expect_false(inherits(summarise_config, "error"))
## Complex
summarise_config = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
expect_false(inherits(summarise_config, "error"))
expect_false(inherits(summarise_config, "error"))
## Complex
summarise_config = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "configr.csl2"), error = function(e){e})
expect_false(inherits(summarise_config, "error"))
## Complex
summarise_config = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "configrcsdff.csl2"), error = function(e){e})
summarise_config
expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2")
summarise_config
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
expect_false(inherits(summarise_config, "error"))
expect_false(inherits(test, "error"))
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
library(r4Casal2)
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
setwd("C:/Users/dattas/OneDrive - NIWA/Projects/2025/FIAR2502 Casal2/r4Casal2/tests/testthat")
test_data_dir = file.path("..","..","inst","testdata")
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
expect_false(inherits(test, "error"))
library(tidyverse)
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
expect_false(inherits(test, "error"))
test
p
p
test_data_dir = file.path("..","..","inst","testdata")
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
tes
test
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
inherits(test, "error")
expect_false(inherits(test, "error"))
names(test)
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
expr
expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2")
expr
## remove first line
temp_file = c(
"#this is a comment",
"This will remain")
expect_equal(StripComments(temp_file), "This will remain")
expect_equal(StripComments(temp_file), "This will remain2")
## multiline comments
temp_file = c(
"/*this is a comment",
"and this is a comment",
"and this is a comment",
"*/",
"This will remain")
StripComments(temp_file)
summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2")
tryCatch(stop(e), error = function(e) e, finally = print("Hello"))
e <- simpleError("test error")
tryCatch(stop(e), error = function(e) e, finally = print("Hello"))
## SBW
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "SBW"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "SBW", verbose = T, prompt_user_before_deleting = F))
test_data_dir
getwd()
test_data_dir = normalizePath(file.path("..","..","inst","testdata"), winslash = "/")
## ComplexTag
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "ComplexTag"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "ComplexTag", verbose = T, prompt_user_before_deleting = F))
## SBW
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "SBW"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "SBW", verbose = T, prompt_user_before_deleting = F))
## TwoSex
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "TwoSex"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "TwoSex", verbose = T, prompt_user_before_deleting = F))
?expect_error
err <- expect_error(rlang::abort("a", n = 10))
err
?expect_flase
?expect_false
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
test
inherits(test, 'error')
expect_false(inherits(test, "error"))
expect_true(inherits(test, "error"))
inherits(test, "error")
expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2")
class(expr)
is.list(expr)
?tryCatch
tryCatch(1, finally = print("Hello"))
e <- simpleError("test error")
e
tryCatch(stop(e), finally = print("Hello"))
tryCatch(stop(e), error = function(e) e, finally = print("Hello"))
demo(error.catching)
test_that("errors catching", {
a <- try_catch(log("a"), .e = ~ return(paste0("There was an error: ", .x)))
expect_is(a, "character")
expect_match(a, "There was an error:")
a <- try_catch(log(1), .e = ~ paste0("There was an error: ", .x))
expect_equal(a, 0)
plop <- function(){
try(log("a"))
attempt(log("a"))
return(12)
}
a <- plop()
expect_equal(a, 12)
})
## Complex
test = tryCatch(expr = summarise_config(config_dir = file.path(test_data_dir, "Complex"), config_file = "config.csl2"), error = function(e){e})
names(test)
## SBW
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "SBW"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "SBW", verbose = T, prompt_user_before_deleting = F))
## ComplexTag
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "ComplexTag"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "ComplexTag", verbose = T, prompt_user_before_deleting = F))
summary = summarise_config(config_dir = '../../inst/testdata/ComplexTag/', config_file = "config.csl2")
summary = summarise_config(config_dir = '../../inst/testdata/ComplexTag/', config_file = "config_betadiff.csl2")
summary
## ComplexTag
expect_message(build_assessment_bookdown(csl_dir = file.path(test_data_dir, "ComplexTag"), output_folder_name = "Bookdown", mpd_filename = "estimate_betadiff.log", config_filename = "config_betadiff.csl2", model_label = "ComplexTag", verbose = T, prompt_user_before_deleting = F))
?tryCatch