rescale: Transform a variable to have a particular mean and standard...

Description Usage Arguments Author(s) Examples

View source: R/rescale.R

Description

This function will take a variable and transform it such that it has a particular mean and variance

Usage

1
rescale(x, new.mean, new.sd)

Arguments

x

A vector containing the data the user wishes to transform

new.mean

The desired mean of the dataset

new.sd

The desired sd of the dataset

Author(s)

Dustin Fife

Examples

1
2
3
4
x = rnorm(100, 0, 1)
## transform to have a mean of 20 and sd of 5
x.new = rescale(x, 50, 5)
mean(x.new); sd(x.new)

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.