-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20a7db2
commit b258f8c
Showing
3 changed files
with
98 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,45 @@ | ||
#' Generate a list of models based on a single dataset and estimation method | ||
#' | ||
#' @param ... Named arguments with the format `"Model description" = | ||
#' modelFunction` | ||
#' @inheritParams nlmixr2est::nlmixr | ||
#' @inheritParams targets::tar_target | ||
#' @return 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()) { | ||
tar_nlmixr_multimodel <- function(name, ..., data, est, control = list(), table = nlmixr2est::tableControl()) { | ||
if (is.null(est)) { | ||
stop("'est' must not be null") | ||
} | ||
name <- targets::tar_deparse_language(substitute(name)) | ||
name_obj_simple <- paste(name, "object_simple", sep = "_tar_") | ||
name_data_simple <- paste(name, "data_simple", sep = "_tar_") | ||
tar_nlmixr_multimodel_parse( | ||
name = targets::tar_deparse_language(substitute(name)), | ||
data = data, | ||
est = est, | ||
control = control, | ||
table = table | ||
) | ||
} | ||
|
||
tar_nlmixr_multimodel_parse <- function(name, data, est, control, table, ...) { | ||
args <- list(...) | ||
checkmate::assert_named(args, type = "unique") | ||
lapply( | ||
X = seq_along(args), | ||
FUN = \(idx, data) { | ||
tar_nlmixr_multimodel_single( | ||
name = name, | ||
object = args[[idx]], | ||
data = data, | ||
description = names(args)[[idx]], | ||
est = est, | ||
control = control, | ||
table = table | ||
) | ||
} | ||
) | ||
} | ||
|
||
tar_nlmixr_multimodel_single <- function(name, object, data, description, est, control, table) { | ||
tar_nlmixr( | ||
) | ||
} |