stretch: Scales random samples

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

stretchR Documentation

Scales random samples

Description

Stretches a vector of values between specified constraints.

Usage

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

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 Nov. 3, 2024, 11:22 p.m.