[HELP] tar_map and write_xl #184
Replies: 5 comments
-
Without a reprex it is difficult to help, but here a sketch of a static pipeline (
library(targets)
library(tarchetypes)
values <- data.frame(
val = 1:3,
names = c("A", "B", "C")
)
tar_map(
values = values,
tar_target(results2, paste(val, "bib")),
tar_target(summary, data.frame(x = paste(results2, "sum"))),
tar_target(save_file, writexl::write_xlsx(summary, paste0(tar_name(), ".xlsx")))
) The folder content to show that the 3 expected excel were written: > fs::dir_tree(recurse = 0)
.
├── _targets/
├── _targets.R
├── save_file_1_A.xlsx
├── save_file_2_B.xlsx
└── save_file_3_C.xlsx and content of one of the excel to show it worked out |
Beta Was this translation helpful? Give feedback.
-
awesome, I'm gonna test out this framework. I was also curious is there a way to use functions from |
Beta Was this translation helpful? Give feedback.
-
What do you have mind? The name |
Beta Was this translation helpful? Give feedback.
-
ah okay. That's fair, I think I will try and figure out the tar_map() function and seeing what I can with that. Earlier you said you need the reprex? what is that exactly? |
Beta Was this translation helpful? Give feedback.
-
It is a minimal reproducible example. Not dependent on external datasets, private objects etc. Details here https://reprex.tidyverse.org/ |
Beta Was this translation helpful? Give feedback.
-
Hello,
I this snippet of a targets script down below. I've try various method but even when the pipeline is successfully build I can't actually create excel files from tar_map.
if you have any ideas please let me know!
Beta Was this translation helpful? Give feedback.
All reactions