This function applies metadata and code transformations to a data.table if provided. It checks if the metadata and codes are supplied as vectors of column names.
Usage
define(
x,
metadata_cols = find_meta_cols(x),
codes_cols = find_binary_cols(x),
horizon_cols = NULL,
units_cols = NULL
)Arguments
- x
A data.table. The data.table to be transformed.
- metadata_cols
A vector of column names or NULL. A vector specifying the columns for metadata transformations.
- codes_cols
A vector of column names or NULL. A vector specifying the columns for code transformations.
- horizon_cols
A vector of column names or NULL. A vector specifying the columns for horizon transformations.
- units_cols
A vector of column names or NULL. A vector specifying the columns for unit transformations.
Examples
library(data.table)
dt <- data.table(a = 1:5, b = 6:10)
dt <- define(dt, metadata = c("a"), codes = c("b"))
