stretch: Scales random samples

Description Usage Arguments Value Examples

View source: R/original/Additional file 2.R View source: R/simulation.R

Description

Stretches a vector of values between specified constraints.

Usage

1
stretch(x, con)

Arguments

x

Vector of values to stretch.

con

Vector in the form of c(min, max) specifying new constraints

Value

A vector of values rescaled to have a minimum of con[1] and a maximum of con[2].

Examples

1
2
3
4
out <- stretch(rnorm(10000), c(-2, 1))
print(summary(out))
hist(out, 20, xlim=c(-2, 2), probability=TRUE,
     main = '', xlab = 'Random variable value')

ssokolen/metcourse documentation built on May 30, 2019, 8:43 a.m.