Log-transform climate variables

logVars(
  dat,
  elements = c("AHM", "DD", "Eref", "FFP", "NFFD", "PAS", "PPT", "SHM", "CMI"),
  base = exp(1),
  add.fields = FALSE,
  zero_adjust = FALSE
)

Arguments

dat

a data.table with columns of climate variables corresponding to the selected climate elements.

elements

character. Climate elements to search for in dat.

base

numeric. Log base.

zero_adjust

logical. If TRUE adjusts zeroes in raw data as: \(base^{\log_base{x_min} - 1}\). where \(x_min\) is the minimum non-zero, non-NA value.

add.vars

logical. If TRUE, the new logged variables are added to dat (TRUE). Otherwise, original column values are replaced with the logs (FALSE).

Value

data.table

Details

All column names that partially match strings in elements will be log-transformed.