process_truncate_by_threshold {simdata}R Documentation

Truncate columns of datamatrix at specified thresholds

Description

Truncation based on fixed thresholds to be applied to a dataset. Allows to implement truncation by measures derived from the overall data generating mechanism.

Usage

process_truncate_by_threshold(
  x,
  truncate_lower = NA,
  truncate_upper = NA,
  only_numeric = TRUE
)

Arguments

x

Matrix or Data.frame.

truncate_lower, truncate_upper

Vectors of truncation parameters, i.e. lower and upper tresholds for truncation. Either a single value which is replicated as necessary or of same dimension as ncol(x). If any vector entry is NA, the corresponding column will not be truncated. Truncation at lower and upper thresholds is treated independently. If named, then the names must correspond to columnnames in x, and only specified columns will be processed. See details.

only_numeric

If TRUE and if x is a data.frame, then only columns of type numeric will be processed. Otherwise all columns will be processed (e.g. also in the case that x is a matrix).

Details

Truncation is defined by setting all values below or above the truncation threshold to the truncation threshold.

Truncation parameters can be specified in three ways (note that whenever only_numeric is set to TRUE, then only numeric columns are affected):

Value

Matrix or data.frame of same dimensions as input.


[Package simdata version 0.4.0 Index]