Closed wlandau closed 4 years ago
Only literate programming remains.
Need to explain how to correctly map over file targets. This way is wrong:
options(crayon.enabled = FALSE, tidyverse.quiet = TRUE)
library(targets)
library(tidyverse)
write_csv(tibble(x1 = 1, x2 = 1), "a.csv")
write_csv(tibble(x1 = 1, x2 = 1), "b.csv")
tar_script({
options(crayon.enabled = FALSE, tidyverse.quiet = TRUE)
library(readr)
tar_pipeline(
tar_target(paths, c("a.csv", "b.csv"), format = "file"),
tar_target(data, read_csv(paths, col_types = "dd"), pattern = map(paths))
)
})
tar_make()
#> ● run target paths
#> ● run branch data_5085a9cd
#> ● run branch data_b7dcad9d
write_csv(tibble(x1 = 2, x2 = 2), "b.csv")
tar_make()
#> ● run target paths
#> ✓ skip branch data_5085a9cd
#> ✓ skip branch data_b7dcad9d
Created on 2020-08-07 by the reprex package (v0.3.0)
Done.
Prework