[R] Mapping data onto score

Ben Tupper PemaquidRiver at tidewater.net
Tue Jul 15 22:34:57 CEST 2008


On Jul 15, 2008, at 8:16 AM, rcoder wrote:

>
> Hi everyone,
>
> I want to score a set of data (-ve to +ve) using a 0-10 scale. I  
> have the
> data in an R matrix, so I need to add another column, containing  
> the scores
> and resave.
>

Hi,

I am a little fuzzy on what you are asking, but my guess is that you  
want to normalize the data into the 0-1 range then multiply by 10.

values <- rnorm(10) #some numbers
mm <- range(values) #the minmax range
scaled <- (values-mm[1])/(mm[2]-mm[1]) #normalize into 0-1
scaled10 <- 10 * scaled #scale 0-10

Is that what you seek?
Ben



More information about the R-help mailing list