Skip to content

Commit

Permalink
Description argument in target factories
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Feb 20, 2024
1 parent 079ef5c commit 80350be
Show file tree
Hide file tree
Showing 82 changed files with 669 additions and 148 deletions.
15 changes: 10 additions & 5 deletions R/tar_change.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ tar_change <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
name <- targets::tar_deparse_language(substitute(name))
name_change <- paste0(name, "_change")
Expand All @@ -83,7 +84,8 @@ tar_change <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand All @@ -105,7 +107,8 @@ tar_change_raw <- function(
resources,
storage,
retrieval,
cue
cue,
description
) {
upstream <- targets::tar_target_raw(
name = name_change,
Expand All @@ -124,7 +127,8 @@ tar_change_raw <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = targets::tar_cue(mode = "always")
cue = targets::tar_cue(mode = "always"),
description = description
)
downstream <- targets::tar_target_raw(
name = name,
Expand All @@ -143,7 +147,8 @@ tar_change_raw <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
list(upstream, downstream)
}
6 changes: 4 additions & 2 deletions R/tar_combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ tar_combine <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
tar_combine_impl(
name = targets::tar_deparse_language(substitute(name)),
Expand All @@ -73,6 +74,7 @@ tar_combine <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}
12 changes: 8 additions & 4 deletions R/tar_combine_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ tar_combine_raw <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
tar_combine_impl(
name = name,
Expand All @@ -69,7 +70,8 @@ tar_combine_raw <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand All @@ -92,7 +94,8 @@ tar_combine_impl <- function(
resources,
storage,
retrieval,
cue
cue,
description
) {
targets::tar_assert_chr(name)
targets::tar_assert_target_list(targets)
Expand Down Expand Up @@ -123,6 +126,7 @@ tar_combine_impl <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}
9 changes: 6 additions & 3 deletions R/tar_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ tar_download <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
name <- targets::tar_deparse_language(substitute(name))
name_url <- paste0(name, "_url")
Expand Down Expand Up @@ -109,7 +110,8 @@ tar_download <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
target_download <- targets::tar_target_raw(
name = name,
Expand All @@ -125,7 +127,8 @@ tar_download <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
list(target_url, target_download)
}
Expand Down
9 changes: 6 additions & 3 deletions R/tar_file_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ tar_file_read <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
format_file <- match.arg(format_file)
name_read <- deparse(rlang::enexpr(name))
Expand Down Expand Up @@ -74,7 +75,8 @@ tar_file_read <- function(
priority = priority,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
),
targets::tar_target_raw(
name = name_read,
Expand All @@ -91,7 +93,8 @@ tar_file_read <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
)
}
6 changes: 4 additions & 2 deletions R/tar_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ tar_files <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
name <- targets::tar_deparse_language(substitute(name))
envir <- tar_option_get("envir")
Expand All @@ -77,6 +78,7 @@ tar_files <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}
6 changes: 4 additions & 2 deletions R/tar_files_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ tar_files_input <- function(
garbage_collection = targets::tar_option_get("garbage_collection"),
priority = targets::tar_option_get("priority"),
resources = targets::tar_option_get("resources"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
name <- targets::tar_deparse_language(substitute(name))
format <- match.arg(format)
Expand All @@ -81,6 +82,7 @@ tar_files_input <- function(
garbage_collection = garbage_collection,
priority = priority,
resources = resources,
cue = cue
cue = cue,
description = description
)
}
9 changes: 6 additions & 3 deletions R/tar_files_input_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ tar_files_input_raw <- function(
garbage_collection = targets::tar_option_get("garbage_collection"),
priority = targets::tar_option_get("priority"),
resources = targets::tar_option_get("resources"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_chr(name, "name must be a character.")
targets::tar_assert_scalar(name, "name must have length 1.")
Expand All @@ -100,7 +101,8 @@ tar_files_input_raw <- function(
resources = resources,
storage = "main",
retrieval = "main",
cue = cue
cue = cue,
description = description
)
name_files_sym <- as.symbol(name_files)
downstream <- targets::tar_target_raw(
Expand All @@ -119,7 +121,8 @@ tar_files_input_raw <- function(
resources = resources,
storage = "main",
retrieval = "main",
cue = cue
cue = cue,
description = description
)
out <- list(upstream, downstream)
names(out) <- c(name_files, name)
Expand Down
9 changes: 6 additions & 3 deletions R/tar_files_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ tar_files_raw <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_chr(name, "name must be a character.")
targets::tar_assert_scalar(name, "name must have length 1.")
Expand All @@ -88,7 +89,8 @@ tar_files_raw <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = targets::tar_cue(mode = "always")
cue = targets::tar_cue(mode = "always"),
description = description
)
name_files_sym <- as.symbol(name_files)
downstream <- targets::tar_target_raw(
Expand All @@ -108,7 +110,8 @@ tar_files_raw <- function(
resources = resources,
storage = "main",
retrieval = "main",
cue = cue
cue = cue,
description = description
)
out <- list(upstream, downstream)
names(out) <- c(name_files, name)
Expand Down
6 changes: 4 additions & 2 deletions R/tar_force.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ tar_force <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
name <- targets::tar_deparse_language(substitute(name))
name_change <- paste0(name, "_change")
Expand All @@ -85,7 +86,8 @@ tar_force <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand Down
6 changes: 4 additions & 2 deletions R/tar_formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ tar_format_alias <- function(format) {
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}, env = list(format = format))
out
Expand All @@ -79,7 +80,8 @@ tar_format_api <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
}

Expand Down
6 changes: 4 additions & 2 deletions R/tar_group_by.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ tar_group_by <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_package("dplyr")
name <- targets::tar_deparse_language(substitute(name))
Expand All @@ -71,7 +72,8 @@ tar_group_by <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand Down
6 changes: 4 additions & 2 deletions R/tar_group_count.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ tar_group_count <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_package("dplyr")
name <- targets::tar_deparse_language(substitute(name))
Expand Down Expand Up @@ -76,7 +77,8 @@ tar_group_count <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand Down
6 changes: 4 additions & 2 deletions R/tar_group_select.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ tar_group_select <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_package("dplyr")
name <- targets::tar_deparse_language(substitute(name))
Expand All @@ -77,7 +78,8 @@ tar_group_select <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand Down
6 changes: 4 additions & 2 deletions R/tar_group_size.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ tar_group_size <- function(
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue")
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
) {
targets::tar_assert_package("dplyr")
name <- targets::tar_deparse_language(substitute(name))
Expand Down Expand Up @@ -78,7 +79,8 @@ tar_group_size <- function(
resources = resources,
storage = storage,
retrieval = retrieval,
cue = cue
cue = cue,
description = description
)
}

Expand Down
Loading

0 comments on commit 80350be

Please sign in to comment.