From 2c672f4152b40a622170b7cd91c2476d4a76962e Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Wed, 20 Mar 2024 11:13:52 -0400 Subject: [PATCH 1/3] Remove set_env_object_noinitial() --- R/tar_nlmixr.R | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/R/tar_nlmixr.R b/R/tar_nlmixr.R index e5e15df..b5ca1af 100644 --- a/R/tar_nlmixr.R +++ b/R/tar_nlmixr.R @@ -79,8 +79,6 @@ tar_nlmixr_raw <- function(name, object, data, est, control, table, object_simpl checkmate::assert_character(object_simple_name, len = 1, min.chars = 1, any.missing = FALSE) checkmate::assert_character(data_simple_name, len = 1, min.chars = 1, any.missing = FALSE) - # Make models with initial conditions set work within `targets` (see #15) - set_env_object_noinitial(object = object, env = env) list( object_simple = targets::tar_target_raw( @@ -143,31 +141,6 @@ tar_nlmixr_raw <- function(name, object, data, est, control, table, object_simpl ) } -#' Ensure that an object is set in its initial environment so that it is -#' protected from the `targets` domain-specific-language issue of -#' `pd(0) <- initial` -#' -#' @inheritParams tar_nlmixr -#' @return NULL (called for side effects) -#' @noRd -set_env_object_noinitial <- function(object, env) { - if (is.name(object)) { - object_env <- env[[as.character(object)]] - if (is.function(object_env)) { - object_result <- try(rxode2::assertRxUi(object_env), silent = TRUE) - if (inherits(object_result, "rxUi")) { - assign(x = as.character(object), value = object_result, envir = env) - } - } - } else if (is.call(object)) { - # Recursively iterate over all parts of the call - lapply(X = object, FUN = set_env_object_noinitial, env = env) - } - # If it's anything other than a name or a call, then we don't need to modify - # it or its sub-objects. - NULL -} - #' Replace the fit data with the original data, then return the modified fit #' #' This function is intended for use within `nlmixr2targets` target creation, From 1625ee60b30012d0a7060a2eede95f67503711a8 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Sun, 5 May 2024 13:54:41 -0400 Subject: [PATCH 2/3] Updates based on code review --- DESCRIPTION | 14 ++++++++------ R/simplify.R | 4 ++-- R/tar_nlmixr.R | 2 +- R/tar_nlmixr_multimodel.R | 2 +- cran-comments.md | 10 ++++++++++ 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 cran-comments.md diff --git a/DESCRIPTION b/DESCRIPTION index 29efaeb..09801e1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,6 +9,14 @@ Description: 'nlmixr2targets' ensures minimal rework in model development with 'nlmixr2' and 'targets' by simplifying and standardizing models and datasets. License: GPL (>= 2) +Depends: + R (>= 4.1) +Imports: + checkmate, + digest, + nlmixr2est, + rxode2 (>= 2.0.14), + targets Suggests: covr, knitr, @@ -20,11 +28,5 @@ Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 -Imports: - checkmate, - digest, - nlmixr2est, - rxode2 (>= 2.0.14), - targets URL: https://nlmixr2.github.io/nlmixr2targets/ VignetteBuilder: knitr diff --git a/R/simplify.R b/R/simplify.R index 5853d9f..6f7bfbb 100644 --- a/R/simplify.R +++ b/R/simplify.R @@ -11,7 +11,7 @@ #' `cmt(initial)` will be converted to `cmt(0)` before passing to nlmixr2. #' #' @inheritParams nlmixr2est::nlmixr -#' @return \code{object} converted to a nlmixrui object. The model name is +#' @returns \code{object} converted to a nlmixrui object. The model name is #' always "object". #' @family Simplifiers #' @export @@ -65,7 +65,7 @@ nlmixr_object_simplify_zero_initial_helper <- function(object) { #' @inheritParams nlmixr2est::nlmixr #' @param object an nlmixr_ui object (e.g. the output of running #' \code{nlmixr(object = model)} -#' @return The data with the nlmixr2 column lower case and on the left and the +#' @returns The data with the nlmixr2 column lower case and on the left and the #' covariate columns on the right and alphabetically sorted. #' @family Simplifiers #' @export diff --git a/R/tar_nlmixr.R b/R/tar_nlmixr.R index b5ca1af..f07054c 100644 --- a/R/tar_nlmixr.R +++ b/R/tar_nlmixr.R @@ -14,7 +14,7 @@ #' @inheritParams targets::tar_target #' @param env The environment where the model is setup (not needed for typical #' use) -#' @return A list of targets for the model simplification, data simplification, +#' @returns A list of targets for the model simplification, data simplification, #' and model estimation. #' @examples #' \dontrun{ diff --git a/R/tar_nlmixr_multimodel.R b/R/tar_nlmixr_multimodel.R index f47d21d..100bf23 100644 --- a/R/tar_nlmixr_multimodel.R +++ b/R/tar_nlmixr_multimodel.R @@ -5,7 +5,7 @@ #' @inheritParams nlmixr2est::nlmixr #' @inheritParams targets::tar_target #' @inheritParams tar_nlmixr -#' @return A list of targets for the model simplification, data simplification, +#' @returns A list of targets for the model simplification, data simplification, #' and model estimation. #' @export tar_nlmixr_multimodel <- function(name, ..., data, est, control = list(), table = nlmixr2est::tableControl(), env = parent.frame()) { diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..b849e86 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,10 @@ +## R CMD check results + +0 errors | 0 warnings | 1 note + +* Even simple workflows for the `nlmixr2targets` library take significant + runtime, more than the few seconds allowed for examples. And, typical + workflows also have a significant amount of code associated with them (tens to + hundreds of lines). For these reasons, the individual functions do not have + examples and examples are put into the vignette. +* This is a new release. From 9ffae228cca4bdc89a9c3939b149d2ea0e658297 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Fri, 7 Jun 2024 10:57:17 -0400 Subject: [PATCH 3/3] Clarify for CRAN --- cran-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index b849e86..dceb654 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -6,5 +6,5 @@ runtime, more than the few seconds allowed for examples. And, typical workflows also have a significant amount of code associated with them (tens to hundreds of lines). For these reasons, the individual functions do not have - examples and examples are put into the vignette. + running examples and user-focused examples are put into the vignette. * This is a new release.