# LinScale: Linear Scaling

### Description

This will scale the numeric vector `x` linearly from an old scale between `low` and `high` to a new one between `newlow` and `newhigh`.

### Usage

 `1` ```LinScale(x, low = NULL, high = NULL, newlow = 0, newhigh = 1) ```

### Arguments

 `x` a numeric matrix(like object). `low` numeric. The minimum value of the scale, defaults to min(x). This is calculated columnwise by default; defined `low` or `high` arguments will be recycled if necessary. `high` numeric. The maximum value of the scale, defaults to max(x). This is calculated columnwise by default; when a maxval is entered, it will be recycled. `newlow` numeric. The minimum value of the new scale, defaults to 0, resulting in a 0-1 scale for x. `newlow` is recycled if necessary. `newhigh` numeric. The maximum value of the scale, defaults to 1. `newhigh` is recycled if necessary.

### Details

Hmm, hardly worth coding...

### Value

The centered and scaled matrix. The numeric centering and scalings used (if any) are returned as attributes "`scaled:center`" and "`scaled:scale`"

### Author(s)

Andri Signorell <andri@signorell.net>

`scale`, `RobScale`, `sweep`

### Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```# transform the temperature from Celsius to Fahrenheit LinScale(d.pizza[1:20, "temperature"], 0, 100, -17.8, 37.8 ) # and the price from Dollar to Euro LinScale(d.pizza[1:20, "price"], 0, 1, 0, 0.76) # together LinScale(d.pizza[1:20, c("temperature", "price")], 0, c(100, 1), c(-17.8, 0), c(37.8, 0.76) ) ## Not run: par(mfrow=c(3,1), mar=c(0,5,0,3), oma=c(5,0,5,0)) plot(LinScale(d.frm[,1]), ylim=c(-2,2), xaxt="n", ylab="LinScale") plot(RobScale(d.frm[,1]), ylim=c(-2,2), xaxt="n", ylab="RobScale") plot(scale(d.frm[,1]), ylim=c(-2,2), ylab="scale") title("Compare scales", outer = TRUE) ## End(Not run) ```

Search within the DescTools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.