rescaleWrapper: Rescale vector elements.

Description Usage Arguments Value Examples

View source: R/people_prediction.R

Description

rescaleWrapper returns the vector of rescaled values

Usage

1
2
rescaleWrapper(x, domain = NULL, range = NULL, bounded = FALSE,
  na.replace = NA)

Arguments

x

a numeric number or vector.

domain

a vector includes minimum and maximum values of the domain of x.

range

a vector includes minimum and maximum values of the range of x.

bounded

a logical scalar. Default is FALSE. The output vector of scaled x can not less or greater than minimum or maximum value of the range of x.

na.replace

a numeric or character that missing values is replaced by. na.replace is missing at default.

Value

the scaled values of x in the range for the given domain.

Examples

1
2
3
4
rescaleWrapper(c(1, 2, 3), range = c(0, 1))
rescaleWrapper(c(0, 1, NA), range = c(0, 1))
rescaleWrapper(c(0, 1, 5, -3, NA), domain = c(0, 10), range = c(0, 1), bounded = FALSE, na.replace = NA)
rescaleWrapper(c(0, 1, 5, -3, NA), domain = c(0, 10), range = c(0, 1), bounded = TRUE, na.replace = NA)

uyenhoang/pplpredict documentation built on May 3, 2019, 2:41 p.m.