data_add
Add an existing file to the data catalog
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
| Argument | Description |
|---|---|
file_path
|
Path to the existing file (must exist) |
name
|
Optional dot notation name for the data catalog (e.g., |
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 |
Returns
Invisibly returns the data spec that was created
Examples
# 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"
Source: R/data_write.R