[R] arbitrary scaling

Jim Lemon jim at bitwrit.com.au
Tue Mar 9 10:22:39 CET 2010


On 03/09/2010 01:37 AM, Petr PIKAL wrote:
> Hi all
>
> I know I probably reinvented wheel but it was maybe simpler then search in
> docs or ask help before I did my part.
>
> I made a simple function which can scale a vector between chosen values.
> Do anybody know simpler/better approach?
> ...
> x<- c(5,30,50)
>
> myscale(x)
> [1] 0.5000000 0.7777778 1.0000000

Hi Petr,
Try this:

library(plotrix)
rescale(x,c(0.5,1))

Jim



More information about the R-help mailing list