[R] Normalizing Vector with Negative Numbers

Greg Snow Greg.Snow at imail.org
Mon Sep 27 18:03:13 CEST 2010


You can use the scale function, just use the minimum instead of the mean and the range instead of the standard deviation.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Gundala Viswanath
> Sent: Sunday, September 26, 2010 6:23 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Normalizing Vector with Negative Numbers
> 
> 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.



More information about the R-help mailing list