Skip to content

Commit

Permalink
Improve reporting of static branch names from tar_map() and tar_map_r…
Browse files Browse the repository at this point in the history
…ep()
  • Loading branch information
wlandau committed Nov 4, 2024
1 parent e23a780 commit 52657ea
Show file tree
Hide file tree
Showing 32 changed files with 357 additions and 82 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# tarchetypes 0.10.0.9002 (development)
# tarchetypes 0.10.0.9003 (development)

* Add an `output_file` argument to `tar_quarto()` and `tar_quarto_raw()` for single documents (#198, @mutlusun).
* Detect child quarto documents (#199, @mutlusun).
* Improve reporting of static branch names from `tar_map()` and `tar_map_rep()` (#201, @kkmann).

# tarchetypes 0.10.0

Expand Down
4 changes: 3 additions & 1 deletion R/tar_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ tar_map_default_suffixes <- function(values) {
}

tar_map_target <- function(target, values, descriptions) {
lapply(
out <- lapply(
X = transpose(values),
FUN = tar_map_iter,
target = target,
command = target$command$expr,
pattern = target$settings$pattern,
descriptions = descriptions
)
names(out) <- map_chr(out, ~.x$settings$name)
out
}

tar_map_iter <- function(values, target, command, pattern, descriptions) {
Expand Down
2 changes: 2 additions & 0 deletions R/tar_map_rep.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tar_map_rep <- function(
rep_workers = 1,
combine = TRUE,
delimiter = "_",
unlist = FALSE,
tidy_eval = targets::tar_option_get("tidy_eval"),
packages = targets::tar_option_get("packages"),
library = targets::tar_option_get("library"),
Expand Down Expand Up @@ -113,6 +114,7 @@ tar_map_rep <- function(
rep_workers = rep_workers,
combine = combine,
delimiter = delimiter,
unlist = unlist,
tidy_eval = tidy_eval,
packages = packages,
library = library,
Expand Down
16 changes: 13 additions & 3 deletions R/tar_map_rep_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tar_map_rep_raw <- function(
rep_workers = 1,
combine = TRUE,
delimiter = "_",
unlist = FALSE,
tidy_eval = targets::tar_option_get("tidy_eval"),
packages = targets::tar_option_get("packages"),
library = targets::tar_option_get("library"),
Expand Down Expand Up @@ -117,9 +118,10 @@ tar_map_rep_raw <- function(
values = values,
names = names,
descriptions = descriptions,
delimiter = delimiter
delimiter = delimiter,
unlist = unlist
)
)
)[[1L]]
)
target_combine <- if_any(
is.null(values) || !combine,
Expand All @@ -142,7 +144,15 @@ tar_map_rep_raw <- function(
description = description
)
)
unlist(list(target_batch, target_static, target_combine), recursive = TRUE)
out <- list(
batch_index = target_batch,
static_branches = target_static,
combine = target_combine
)
if (unlist) {
out <- unlist(out, recursive = TRUE)
}
out
}

tar_map_combine_command <- expression({
Expand Down
13 changes: 11 additions & 2 deletions man/tar_age.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_change.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_combine.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions man/tar_download.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_file_read.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_files.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_files_input.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_force.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_formats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_formats_superseded.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions man/tar_group_by.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 52657ea

Please sign in to comment.