scal: Scale a vector

Description Usage Arguments Value Author(s) Examples

Description

This is designed to rescale a vector, between two numbers. often designed for plotting purposes to scale valeus for point sizes

Usage

1
scal(x, scal = c(0, 1), lims = NULL, sqrt = F, na.rm = F, limit = TRUE)

Arguments

x

numbers to be rescaled

scal

vector of two listing the new minimum and maximum values

lims

values that should represent the minimum and maximum scaled value

sqrt

should the data be square root transformed

na.rm

how to handle NAs

limit

TRUE/FALSE if lims is supplied, should values smaller than the minimum lims or greater than the maximum lims be limited to the minimum and maximum scal

Value

a vector of rescaled values

Author(s)

Connor F. White

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
values<-rnorm(100)

#rescale the values between 0 and 1
scal(values,scal=c(0,1))

#in order to minimize influence of outliers
scal(values,scal=c(0,1), lims=c(-1,1))

#allow values outside of -1 and 1 to get bigger and smaller
scal(values,scal=c(0,1), lims=c(-1,1),limit=FALSE)

ConnorFWhite/AssFunc documentation built on May 20, 2019, 4:07 p.m.