transform_dt: Helper function to transform values in a data.table

Description Usage Arguments Value Examples

View source: R/popReconstruct_settings.R

Description

Helper function to transform values in a data.table

Usage

1
transform_dt(dt, value_col, transformation, transformation_arguments)

Arguments

dt

[data.table(1)]
The data.table to apply the transformation functions to.

value_col

[character(1)]
The column in dt to transform.

transformation

[function(1)]
NULL if no transformation. Otherwise transformation function to apply to value_col.

transformation_arguments

[list()]
NULL if no transformation. Otherwise list of arguments to provide to the corresponding transformation function(s).

Value

invisibly return dt with transformed values.

Examples

1
2
3
4
5
6
popMethods:::transform_dt(
  dt = data.table::data.table(year = 1950, value = 2.5),
  value_col = "value",
  transformation = demUtils::logit,
  transformation_arguments = list(domain_lower = 0, domain_upper = 5)
)

ihmeuw-demographics/popMethods documentation built on Jan. 29, 2021, 12:39 p.m.