From ae929b93eccd5c9fb9bbfa2b9ccb8a0a812f4675 Mon Sep 17 00:00:00 2001 From: wlandau-lilly Date: Tue, 20 Feb 2024 13:08:52 -0500 Subject: [PATCH] desciptions for the rest of static branching factories --- NEWS.md | 5 +++-- R/tar_map2.R | 2 ++ R/tar_map2_count.R | 2 ++ R/tar_map2_count_raw.R | 2 ++ R/tar_map2_raw.R | 5 +++++ R/tar_map2_size.R | 2 ++ R/tar_map2_size_raw.R | 2 ++ man/tar_map2.Rd | 6 ++++++ man/tar_map2_count.Rd | 6 ++++++ man/tar_map2_count_raw.Rd | 6 ++++++ man/tar_map2_raw.Rd | 6 ++++++ man/tar_map2_size.Rd | 6 ++++++ man/tar_map2_size_raw.Rd | 6 ++++++ 13 files changed, 54 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6c8047e..377285b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ -# tarchetypes 0.7.12.9000 (development) - +# tarchetypes 0.7.12.9001 (development) +* Expose the new `description` argument of `tar_target()` in `targets` 1.5.1.9001. +* `tar_map()` and other static branching target factories now append values to the target descriptions. Use the `descriptions` argument of those functions to customize. # tarchetypes 0.7.12 diff --git a/R/tar_map2.R b/R/tar_map2.R index ec700e2..90cbe37 100644 --- a/R/tar_map2.R +++ b/R/tar_map2.R @@ -43,6 +43,7 @@ tar_map2 <- function( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), group = rep(1L, nrow(as.data.frame(!!.x))), combine = TRUE, suffix1 = "1", @@ -72,6 +73,7 @@ tar_map2 <- function( command2 = substitute(command2), values = values, names = substitute(names), + descriptions = substitute(descriptions), group = substitute(group), combine = combine, suffix1 = suffix1, diff --git a/R/tar_map2_count.R b/R/tar_map2_count.R index 1fbf410..f903392 100644 --- a/R/tar_map2_count.R +++ b/R/tar_map2_count.R @@ -48,6 +48,7 @@ tar_map2_count <- function( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), batches = 1L, combine = TRUE, suffix1 = "1", @@ -77,6 +78,7 @@ tar_map2_count <- function( command2 = substitute(command2), values = values, names = substitute(names), + descriptions = substitute(descriptions), batches = batches, combine = combine, suffix1 = suffix1, diff --git a/R/tar_map2_count_raw.R b/R/tar_map2_count_raw.R index 90f6db9..8112f7c 100644 --- a/R/tar_map2_count_raw.R +++ b/R/tar_map2_count_raw.R @@ -58,6 +58,7 @@ tar_map2_count_raw <- function( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), batches = 1L, combine = TRUE, suffix1 = "1", @@ -94,6 +95,7 @@ tar_map2_count_raw <- function( command2 = command2, values = values, names = names, + descriptions = descriptions, group = group, combine = combine, suffix1 = suffix1, diff --git a/R/tar_map2_raw.R b/R/tar_map2_raw.R index 85d4834..4f7b5ed 100644 --- a/R/tar_map2_raw.R +++ b/R/tar_map2_raw.R @@ -42,6 +42,7 @@ tar_map2_raw <- function( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), group = quote(rep(1L, nrow(as.data.frame(!!.x)))), combine = TRUE, columns1 = quote(tidyselect::everything()), @@ -81,6 +82,9 @@ tar_map2_raw <- function( if (!is.null(names)) { targets::tar_assert_lang(names) } + if (!is.null(descriptions)) { + targets::tar_assert_lang(descriptions) + } if (!is.null(columns1)) { targets::tar_assert_lang(columns1) } @@ -160,6 +164,7 @@ tar_map2_raw <- function( target_downstream, values = values, names = names, + descriptions = descriptions, unlist = FALSE ) ) diff --git a/R/tar_map2_size.R b/R/tar_map2_size.R index 47a8546..722c6f0 100644 --- a/R/tar_map2_size.R +++ b/R/tar_map2_size.R @@ -48,6 +48,7 @@ tar_map2_size <- function( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), size = Inf, combine = TRUE, suffix1 = "1", @@ -77,6 +78,7 @@ tar_map2_size <- function( command2 = substitute(command2), values = values, names = substitute(names), + descriptions = substitute(descriptions), size = size, combine = combine, suffix1 = suffix1, diff --git a/R/tar_map2_size_raw.R b/R/tar_map2_size_raw.R index 28402ff..c10ba14 100644 --- a/R/tar_map2_size_raw.R +++ b/R/tar_map2_size_raw.R @@ -58,6 +58,7 @@ tar_map2_size_raw <- function( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), size = Inf, combine = TRUE, suffix1 = "1", @@ -94,6 +95,7 @@ tar_map2_size_raw <- function( command2 = command2, values = values, names = names, + descriptions = descriptions, group = group, combine = combine, suffix1 = suffix1, diff --git a/man/tar_map2.Rd b/man/tar_map2.Rd index 7d6b52a..045c5b1 100644 --- a/man/tar_map2.Rd +++ b/man/tar_map2.Rd @@ -10,6 +10,7 @@ tar_map2( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), group = rep(1L, nrow(as.data.frame(!!.x))), combine = TRUE, suffix1 = "1", @@ -60,6 +61,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{group}{Function on the data produced by \code{command1} to create the \code{tar_group} column that determines the batching structure for the \code{command2} targets.} diff --git a/man/tar_map2_count.Rd b/man/tar_map2_count.Rd index 6daec4c..b921d87 100644 --- a/man/tar_map2_count.Rd +++ b/man/tar_map2_count.Rd @@ -11,6 +11,7 @@ tar_map2_count( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), batches = 1L, combine = TRUE, suffix1 = "1", @@ -75,6 +76,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{batches}{Number of batches. This is also the number of dynamic branches created during \code{tar_make()}.} diff --git a/man/tar_map2_count_raw.Rd b/man/tar_map2_count_raw.Rd index ad31240..3ca30b0 100644 --- a/man/tar_map2_count_raw.Rd +++ b/man/tar_map2_count_raw.Rd @@ -11,6 +11,7 @@ tar_map2_count_raw( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), batches = 1L, combine = TRUE, suffix1 = "1", @@ -75,6 +76,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{batches}{Positive integer of length 1, maximum number of batches (dynamic branches within static branches) of the downstream (\code{command2}) targets. Batches diff --git a/man/tar_map2_raw.Rd b/man/tar_map2_raw.Rd index 396aa8f..8a16582 100644 --- a/man/tar_map2_raw.Rd +++ b/man/tar_map2_raw.Rd @@ -10,6 +10,7 @@ tar_map2_raw( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), group = quote(rep(1L, nrow(as.data.frame(!!.x)))), combine = TRUE, columns1 = quote(tidyselect::everything()), @@ -60,6 +61,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{group}{Function on the data produced by \code{command1} to create the \code{tar_group} column that determines the batching structure for the \code{command2} targets.} diff --git a/man/tar_map2_size.Rd b/man/tar_map2_size.Rd index c6be41f..b633362 100644 --- a/man/tar_map2_size.Rd +++ b/man/tar_map2_size.Rd @@ -11,6 +11,7 @@ tar_map2_size( command2, values = NULL, names = NULL, + descriptions = tidyselect::everything(), size = Inf, combine = TRUE, suffix1 = "1", @@ -75,6 +76,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{size}{Positive integer of length 1, maximum number of rows in each batch for the downstream (\code{command2}) targets. Batches diff --git a/man/tar_map2_size_raw.Rd b/man/tar_map2_size_raw.Rd index 73602cb..1605e36 100644 --- a/man/tar_map2_size_raw.Rd +++ b/man/tar_map2_size_raw.Rd @@ -11,6 +11,7 @@ tar_map2_size_raw( command2, values = NULL, names = NULL, + descriptions = quote(tidyselect::everything()), size = Inf, combine = TRUE, suffix1 = "1", @@ -75,6 +76,11 @@ to select which columns of \code{values} to use to construct statically branched target names. If \code{NULL}, then short names are automatically generated.} +\item{descriptions}{Names of a column in \code{values} +to append to the custom description of each generated target. +The value of \code{descriptions} should be a \code{tidyselect} expression +such as a call to \code{\link[=any_of]{any_of()}} or \code{\link[=starts_with]{starts_with()}}.} + \item{size}{Positive integer of length 1, maximum number of rows in each batch for the downstream (\code{command2}) targets. Batches