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

View source: R/rescale.R

rescaleR Documentation

Transform a variable to have a particular mean and standard deivation

Description

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

Usage

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

Value

a vector of rescaled values

Author(s)

Dustin Fife

Examples

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/flexplot documentation built on Sept. 23, 2024, 9:01 p.m.