diff --git a/DESCRIPTION b/DESCRIPTION index 3a08a93..00f537f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,6 +33,7 @@ BugReports: https://github.com/SticsRPacks/CroptimizR/issues Depends: R (>= 4.0.0) Imports: + Matrix, BayesianTools, crayon, doParallel, @@ -65,7 +66,7 @@ Suggests: VignetteBuilder: knitr Remotes: - github::florianhartig/BayesianTools/BayesianTools@c953ae2bf8c112f95fdda1a35b2ff33a1f00c208, + github::cran/Matrix@1.6-5, github::hol430/ApsimOnR, github::SticsRPacks/CroPlotR@*release, github::SticsRPacks/SticsOnR@*release, diff --git a/R/compute_eq_const.R b/R/compute_eq_const.R index 757a9ca..da9f197 100644 --- a/R/compute_eq_const.R +++ b/R/compute_eq_const.R @@ -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,"`"))) } } diff --git a/R/is_data.R b/R/is_data.R index c68e8c7..6fbda8d 100644 --- a/R/is_data.R +++ b/R/is_data.R @@ -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) ))) {