rescale: Rescale Variables in R

Description Usage Arguments Value Examples

View source: R/rescale.R

Description

This functions makes it easier to rescale continuous variables.

Usage

1
rescale(x, type = "z", na.rm = T)

Arguments

x

A vector of interval-type data to standardise.

type

One of "z", "mean", "gelman", "01". Option "z" converts the scale to z-scores. Option "mean" rescales the data so that its mean is zero. Option "gelman" rescales the data so that it is centred on zero and a one-unit increase or decrease corresponds with the scale moving to its 97.5th and 2.5th percentile. Option "01" rescales the data from 0 to 1. Option "11" rescales the data from -1 to 1.

na.rm

Remove missing data? Defaults to TRUE.

Value

A vector of rescaled data.

Examples

1
2
x <- rnorm(100, 1, .2)
rescale(x, type = "z")

jackobailey/jbmisc documentation built on Dec. 14, 2021, 12:11 a.m.