Learn R Programming

rENA (version 0.3.0)

define: Apply metadata and code transformations to a data.table

Description

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
)

Value

The modified data.table after applying the metadata and code transformations.

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

Run this code
library(data.table)
dt <- data.table(a = 1:5, b = 6:10)
dt <- define(dt, metadata = c("a"), codes = c("b"))

Run the code above in your browser using DataLab