[R] Normalizing Vector with Negative Numbers

jim holtman jholtman at gmail.com
Mon Sep 27 02:27:50 CEST 2010


Is the what you want:

> x
[1] -0.0000005282  0.0000000314  0.0000002851 -2.5059217162
-0.0000007545 -1.0317758496  0.0000001598
[8] -1.2981735068  0.0000072411
> (x-min(x))/(max(x) - min(x))
[1] 0.9999969 0.9999971 0.9999972 0.0000000 0.9999968 0.5882632
0.9999972 0.4819563 1.0000000
>


On Sun, Sep 26, 2010 at 8:22 PM, Gundala Viswanath <gundalav at gmail.com> wrote:
> Dear expert,
>
> I have a series of number that looks like this
>
> x <- c(-0.0000005282,
> 0.0000000314,
> 0.0000002851,
> -2.5059217162,
> -0.0000007545,
> -1.0317758496,
> 0.0000001598,
> -1.2981735068,
> 0.0000072411)
>
> How can I normalize it in R so that the new numbers
> is ranging from 0 to 1 ?
>
>
> - G.V.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list