Skip to content

Commit

Permalink
Merge branch 'main' into improve_interface_for_bayesian
Browse files Browse the repository at this point in the history
  • Loading branch information
sbuis committed Jul 23, 2024
2 parents b54e225 + a580367 commit 7829427
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ BugReports: https://github.com/SticsRPacks/CroptimizR/issues
Depends:
R (>= 4.0.0)
Imports:
Matrix,
BayesianTools,
crayon,
doParallel,
Expand Down Expand Up @@ -65,7 +66,7 @@ Suggests:
VignetteBuilder:
knitr
Remotes:
github::florianhartig/BayesianTools/BayesianTools@c953ae2bf8c112f95fdda1a35b2ff33a1f00c208,
github::cran/[email protected],
github::hol430/ApsimOnR,
github::SticsRPacks/CroPlotR@*release,
github::SticsRPacks/SticsOnR@*release,
Expand Down
10 changes: 7 additions & 3 deletions R/compute_eq_const.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ compute_eq_const <- function(forced_param_values, param_values) {

for (irow in 1:nrows) {

# Backticks are added here and in the following to handle parameters names
# including special characters
expr_ls <-
lapply(names(forced_param_values), function(x) paste(x,"<-",forced_param_values[[x]]))
lapply(names(forced_param_values), function(x) paste0("`",x,"`","<-",
forced_param_values[[x]]))
names(expr_ls) <- names(forced_param_values)

for (par in names(param_values)) {
eval(parse(text = paste(par,"<-",param_values[[irow, par]])))
eval(parse(text = paste0("`",par,"`","<-",param_values[[irow, par]])))
}
for (par in names(forced_param_values)) {
eval(parse(text = expr_ls[[par]]))
eval(parse(text = paste0("comp_forced_values[irow,\"",par,"\"] <- ",par)))
eval(parse(text = paste0("comp_forced_values[irow,\"",par,"\"] <- ",
"`",par,"`")))
}

}
Expand Down
2 changes: 1 addition & 1 deletion R/is_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
is.data <- function(data_list) {

# Check data_list format
if (!is.list(data_list) || !all(sapply(
if (length(data_list)==0 || !is.list(data_list) || !all(sapply(
data_list,
function(x) is.data.frame(x)
))) {
Expand Down

0 comments on commit 7829427

Please sign in to comment.