rescale_to: Rescale vector to given mean and SD

Description Usage Arguments Value See Also Examples

View source: R/rescale_to.R

Description

Rescale vector to given mean and SD

Usage

1
rescale_to(x, mu, s, na.rm = FALSE)

Arguments

x

numeric; values to be rescaled

mu, sigma

numeric; target mean and standard deviation

na.rm

logical; passed to mean() and sd()

Value

Numeric vector of the same length as x of the rescaled values.

See Also

scale() and scales::rescale() for rescaling to new minimum and maximum.

Examples

1
2
x <- rescale_to(rnorm(20), 100, 50)
mean(x); sd(x)

mbojan/mbstats documentation built on Dec. 21, 2021, 3:56 p.m.