33#
44# Setup:
55#
6- # 1. Set the `input_dir ` and `output_dir` under "Configuration" below.
6+ # 1. Set `sas_paths ` and `output_dir` under "Configuration" below.
77# 2. Run `targets::tar_make()` (in the same directory) to convert
88# registers to Parquet.
99#
10- # Note: this pipeline re-converts all files on every `tar_make()` call by
11- # deleting files in the output directory before converting. The main benefit of
12- # targets here is parallel execution across workers.
10+ # Note: on every `tar_make()` call, the output directory is cleared and all
11+ # SAS files are re-converted. The `sas_paths` target only re-runs when the
12+ # list of input files changes. The main benefit of targets here is parallel
13+ # execution across workers.
1314#
1415# For more information on targets, see https://books.ropensci.org/targets/
1516
@@ -18,20 +19,13 @@ library(targets)
1819# Configuration ----------------------------------------------------------------
1920
2021config <- list (
21- # Path to locate SAS files in.
22- input_dir = " /path/to/register/ sas/files/ directory" ,
22+ # Paths to SAS files
23+ sas_paths = list_sas_files( " /path/to/sas/directory" ) ,
2324 # Path to output Parquet files in. Parquet files will be located in
2425 # subdirectories of this directory.
2526 output_dir = " /path/to/output/directory"
2627)
2728
28- # Check input directory.
29- if (! dir.exists(config $ input_dir )) {
30- cli :: cli_abort(
31- message = " Input directory does not exist: {config$input_dir}"
32- )
33- }
34-
3529# Target options ---------------------------------------------------------------
3630
3731tar_option_set(
@@ -61,9 +55,7 @@ tar_option_set(
6155list (
6256 tar_target(
6357 name = sas_paths ,
64- command = list_sas_files(config $ input_dir ),
65- deployment = " main" ,
66- cue = tar_cue(mode = " always" )
58+ command = config $ sas_paths
6759 ),
6860
6961 # Empty output directory before writing to avoid outdated Parquet files.
0 commit comments