From 624e583769adc2e62ae912ce6954027c66c402d3 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Sun, 17 Mar 2024 13:31:33 -0400 Subject: [PATCH] tar_nlmixr_multimodel() works with origData reassignment --- R/tar_nlmixr_multimodel.R | 1 + tests/testthat/test-tar_nlmixr_multimodel.R | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/R/tar_nlmixr_multimodel.R b/R/tar_nlmixr_multimodel.R index 2fc3c01..9227e21 100644 --- a/R/tar_nlmixr_multimodel.R +++ b/R/tar_nlmixr_multimodel.R @@ -70,6 +70,7 @@ tar_nlmixr_multimodel_single <- function(object, name, data, est, control, table table = table, object_simple_name = paste0(name_hash, "_osimple"), data_simple_name = paste0(name_hash, "_dsimple"), + fit_simple_name = paste0(name_hash, "_fitsimple"), env = env ) list( diff --git a/tests/testthat/test-tar_nlmixr_multimodel.R b/tests/testthat/test-tar_nlmixr_multimodel.R index 7a0fa3f..184beff 100644 --- a/tests/testthat/test-tar_nlmixr_multimodel.R +++ b/tests/testthat/test-tar_nlmixr_multimodel.R @@ -45,9 +45,9 @@ test_that("tar_nlmixr_multimodel", { # One for each model and then one for combining everything expect_length(target_list, 3) # Data and object simplification, then the fitting - expect_length(target_list[[1]], 3) + expect_length(target_list[[1]], 4) # Data and object simplification, then the fitting - expect_length(target_list[[2]], 3) + expect_length(target_list[[2]], 4) # Combine the fit models as a single step expect_s3_class(target_list[[3]], "tar_stem") expect_equal(target_list[[3]]$settings$name, "foo") @@ -59,8 +59,8 @@ test_that("tar_nlmixr_multimodel", { expect_equal(names(collating_call), c("", "my first model", "my second model")) # Verify the targets created are the ones being collated - expect_equal(collating_call[[2]], as.name(target_list[[1]][[3]]$settings$name)) - expect_equal(collating_call[[3]], as.name(target_list[[2]][[3]]$settings$name)) + expect_equal(collating_call[[2]], as.name(target_list[[1]][[4]]$settings$name)) + expect_equal(collating_call[[3]], as.name(target_list[[2]][[4]]$settings$name)) }) test_that("tar_nlmixr_multimodel works with long model names", {