Skip to contents

Reads the most recent built taxonomy CSV from a directory and saves it as a dated RDS file in the package's extdata directory. These CSVs are produced by the companion macro-taxonomy pipeline, which writes them to its data/output/ directory.

Usage

refresh_taxonomy(input_dir = NULL, output_path = "inst/extdata/")

Arguments

input_dir

Character. Path to a directory containing built taxonomy CSV files named taxonomy_<YYYYMMDD>.csv. Required; there is no default.

output_path

Character. Path to the output directory where the RDS file will be saved. Defaults to "inst/extdata/".

Value

Invisibly returns the taxonomy data frame. Called for its side effect of writing an RDS file named taxonomy_<YYYY-MM-DD>.rds to output_path. The date in the output filename is taken from the source CSV, so re-running on an older CSV does not mislabel it as current.

Details

"Most recent" is determined by the date in the filename, not by file modification time, so the result does not depend on checkout or copy order.

Examples

if (FALSE) { # \dontrun{
# Refresh from the macro-taxonomy pipeline's output directory
refresh_taxonomy(
  input_dir   = "path/to/macro-taxonomy/data/output",
  output_path = "inst/extdata/"
)
} # }