From 7e00961e2013bbaf2e31e13c27b60f9214d40bb3 Mon Sep 17 00:00:00 2001 From: "Morgan-Wall, Tyler T" Date: Tue, 3 Dec 2024 14:55:04 -0500 Subject: [PATCH] skpr v1.7.4: Fix bug in skprGUI where a model with hard to change terms and a manually specified model would not be converted from a character string to a formula --- .Rbuildignore | 2 ++ .gitignore | 2 ++ DESCRIPTION | 7 ++++--- R/skprGUI.R | 2 +- src/RcppExports.cpp | 2 +- src/genOptimalDesign.cpp | 14 ++++++++------ 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 257d3a5..3f2d07a 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -18,3 +18,5 @@ ^pkgdown$ ^tests/.*$ _\.new\.png$ +^compile_commands\.json$ +^\.cache$ diff --git a/.gitignore b/.gitignore index bd429a0..18d80e7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ src/*.dll docs # {shinytest2}: Ignore new debug snapshots for `$expect_values()` *_.new.png +compile_commands.json +.cache diff --git a/DESCRIPTION b/DESCRIPTION index beca19d..115c3e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: skpr Title: Design of Experiments Suite: Generate and Evaluate Optimal Designs -Date: 2024-07-11 -Version: 1.7.3 +Date: 2024-12-03 +Version: 1.7.4 Authors@R: c(person("Tyler", "Morgan-Wall", email = "tylermw@gmail.com", role = c("aut", "cre")), person("George", "Khoury", email = "george.m.khoury@gmail.com", role = c("aut"))) Description: Generates and evaluates D, I, A, Alias, E, T, and G optimal designs. Supports generation and evaluation of blocked and split/split-split/.../N-split plot designs. Includes parametric and Monte Carlo power evaluation functions, and supports calculating power for censored responses. Provides a framework to evaluate power using functions provided in other packages or written by the user. Includes a Shiny graphical user interface that displays the underlying code used to create and evaluate the design to improve ease-of-use and make analyses more reproducible. For details, see Morgan-Wall et al. (2021) . @@ -9,7 +9,7 @@ Copyright: Institute for Defense Analyses Depends: R (>= 3.0.2) License: GPL-3 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Imports: utils, iterators, @@ -36,3 +36,4 @@ Encoding: UTF-8 URL: https://github.com/tylermorganwall/skpr, https://tylermorganwall.github.io/skpr/ BugReports: https://github.com/tylermorganwall/skpr/issues +Config/build/compilation-database: true diff --git a/R/skprGUI.R b/R/skprGUI.R index 20d33af..f0d0e10 100644 --- a/R/skprGUI.R +++ b/R/skprGUI.R @@ -1807,7 +1807,7 @@ skprGUI = function(browser = FALSE, return_app = FALSE, multiuser = FALSE, progr regex = paste0("(\\b", term, "\\b)|(\\b", term, ":)|(:", term, "\\b)|(\\b", term, "\\s\\*)|(\\*\\s", term, "\\b)|(:", term, ":)") regularmodel = regularmodel | grepl(regex, modelsplit, perl = TRUE) } - paste0("~", paste(modelsplit[!regularmodel], collapse = " + ")) + as.formula(paste0("~", paste(modelsplit[!regularmodel], collapse = " + "))) } } }) diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 5e5abf8..27d3094 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -150,7 +150,7 @@ BEGIN_RCPP END_RCPP } // genOptimalDesign -List genOptimalDesign(Eigen::MatrixXd initialdesign, const Eigen::MatrixXd& candidatelist, const std::string condition, const Eigen::MatrixXd& momentsmatrix, Eigen::VectorXd initialRows, Eigen::MatrixXd aliasdesign, const Eigen::MatrixXd& aliascandidatelist, double minDopt, double tolerance, int augmentedrows, int kexchange); +Rcpp::List genOptimalDesign(Eigen::MatrixXd initialdesign, const Eigen::MatrixXd& candidatelist, const std::string condition, const Eigen::MatrixXd& momentsmatrix, Eigen::VectorXd initialRows, Eigen::MatrixXd aliasdesign, const Eigen::MatrixXd& aliascandidatelist, double minDopt, double tolerance, int augmentedrows, int kexchange); RcppExport SEXP _skpr_genOptimalDesign(SEXP initialdesignSEXP, SEXP candidatelistSEXP, SEXP conditionSEXP, SEXP momentsmatrixSEXP, SEXP initialRowsSEXP, SEXP aliasdesignSEXP, SEXP aliascandidatelistSEXP, SEXP minDoptSEXP, SEXP toleranceSEXP, SEXP augmentedrowsSEXP, SEXP kexchangeSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; diff --git a/src/genOptimalDesign.cpp b/src/genOptimalDesign.cpp index 943e718..6105fd6 100644 --- a/src/genOptimalDesign.cpp +++ b/src/genOptimalDesign.cpp @@ -1,6 +1,8 @@ +#include #include // [[Rcpp::depends(RcppEigen)]] #include +#include #include "optimalityfunctions.h" #include "nullify_alg.h" @@ -21,12 +23,12 @@ using namespace Rcpp; //`@param augmentedrows The rows that are fixed during the design search. //`@return List of design information. // [[Rcpp::export]] -List genOptimalDesign(Eigen::MatrixXd initialdesign, const Eigen::MatrixXd& candidatelist, - const std::string condition, - const Eigen::MatrixXd& momentsmatrix, Eigen::VectorXd initialRows, - Eigen::MatrixXd aliasdesign, - const Eigen::MatrixXd& aliascandidatelist, - double minDopt, double tolerance, int augmentedrows, int kexchange) { +Rcpp::List genOptimalDesign(Eigen::MatrixXd initialdesign, const Eigen::MatrixXd& candidatelist, + const std::string condition, + const Eigen::MatrixXd& momentsmatrix, Eigen::VectorXd initialRows, + Eigen::MatrixXd aliasdesign, + const Eigen::MatrixXd& aliascandidatelist, + double minDopt, double tolerance, int augmentedrows, int kexchange) { RNGScope rngScope; int nTrials = initialdesign.rows(); double numberrows = initialdesign.rows();