data_add: Add an existing file to the data catalog

View source: R/data_write.R

data_addR Documentation

Add an existing file to the data catalog

Description

Registers an existing data file with the Framework data catalog. This allows you to track files that were created outside of Framework (e.g., downloaded from external sources, copied from other projects) and use them with data_read() using dot notation.

Usage

data_add(
  file_path,
  name = NULL,
  type = NULL,
  delimiter = "comma",
  locked = TRUE,
  update_config = TRUE
)

Arguments

file_path

Path to the existing file (must exist)

name

Optional dot notation name for the data catalog (e.g., inputs.raw.survey_data). If NULL, derives name from file path relative to project root.

type

Optional type override. Auto-detected from file extension if NULL.

delimiter

Delimiter for CSV files ("comma", "tab", "semicolon", "space")

locked

Whether the file should be locked (hash-verified on read)

update_config

If TRUE (default), also updates the YAML config with the data spec

Value

Invisibly returns the data spec that was created

Examples


if (FALSE) {
# Add a downloaded CSV file to the catalog
data_add("inputs/raw/survey_results.csv", name = "inputs.raw.survey_results")

# Now you can read it with dot notation
data_read("inputs.raw.survey_results")

# Add with auto-generated name
data_add("inputs/intermediate/cleaned_data.rds")
# Name will be derived as "inputs.intermediate.cleaned_data"
}



framework documentation built on Feb. 18, 2026, 1:07 a.m.