Skip to content

A convenience wrapper around tarchetypes::tar_file_read() for Parquet files. Creates a pair of targets: one to track the file with format = "file", and another to read the file with arrow::read_parquet().

Usage

tar_parquet_read(name, command, .read_parquet_args, ...)

Arguments

name

Symbol, name of the target.

command

Expression, R code that returns the file path to the Parquet file.

.read_parquet_args

A named list of additional arguments passed to arrow::read_parquet().

...

Additional arguments passed to targets::tar_target_raw() for the read target.

Value

A list of two target objects: a file-tracking target (name_file) and a Parquet-reading target (name).

Details

The read target's storage format defaults to "parquet" (overriding the usual targets::tar_option_get("format") inheritance), so the cached object is written as a Parquet file in _targets/objects/. Callers can override this by passing e.g. format = "rds" via ....

Examples

if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) {
targets::tar_dir({
  targets::tar_script({
    library(targets)
    list(
      epitargets::tar_parquet_read(my_data, "data.parquet")
    )
  })
  targets::tar_manifest()
})
}