xscale: xscale

Description Usage Arguments Details Value Author(s) Examples

Description

internal function: xscale

Usage

1
xscale(x, torange, xrange = c(min(x), max(x)))

Arguments

x

numeric vector to be transformed

torange

new range

xrange

optional. full range of x vector if you are scaling only part of it. calculated from x if not supplied.

Details

Linear transformation to map x to a new range, so min(x)==xrange[1], and max(x)==xrange[2]

Value

transformed numeric vector

Author(s)

Chris Wallace

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x<-1:10
cbind(x,
      GUESSFM:::xscale(x,c(0.1,1)),
      GUESSFM:::xscale(x,c(1319,20578)))
## Now use only part of x
x<-x[2:7]
## WRONG
cbind(x,
      GUESSFM:::xscale(x,c(0.1,1)),
      GUESSFM:::xscale(x,c(1319,20578)))
## RIGHT
cbind(x,
      GUESSFM:::xscale(x,c(0.1,1),xrange=c(1,10)),
      GUESSFM:::xscale(x,c(1319,20578),xrange=c(1,10)))

chr1swallace/GUESSFM documentation built on May 13, 2019, 6:17 p.m.