scaleValues: Scaling helper function for fillMissing

Description Usage Arguments Value

View source: R/utilities-data-validation.R

Description

Takes input array and scales to upper and lower bounds, which are either defined by lower and upper or calculated depending on the type of variable. (Note that input array will always be numeric; varType refers to the variable type of the input array in the fillMissing function.)

Usage

1
2
scaleValues(vals, varType, lower = NULL, upper = NULL,
  categories = NULL)

Arguments

vals

Input array of values to scale Type: numeric array

varType

Variable type of input array to fillMissing function; affects how scaling occurs. Type: one of following strings: 'character', 'factor', 'logical', 'integer', 'numeric'.

lower

Lower bound for scaling. Type: numeric

upper

Upper bound for scaling. Type: numeric

categories

List of categories. Type: factor

Value

Array of values, either characters, integers, logicals, numerics depending on varType, scaled according to either the number of categories if varType='factor' or 'character', or based on lower and upper when varType='logical','numeric', or 'integer'.


IQSS/PSI-Library documentation built on Feb. 15, 2020, 9:03 p.m.