Re: [R] Mapping data onto score

From: Ben Tupper <PemaquidRiver_at_tidewater.net>
Date: Tue, 15 Jul 2008 17:34:42 -0400

On Jul 15, 2008, at 5:16 PM, rcoder wrote:

>
> Hi Ben,
> Yes, this is more or less what I want to do. I want to apply this
> data in
> columns in a matrix, and insert the results to additional columns.
> I am not
> entirely aware of a good way of doing this.
>
> e.g. take data from column B, apply normalisation, and feed output
> into
> column C
>

Oh,

I think you want to use cbind() to add columns to a matrix. Perhaps like this which works with the second column...

v <- matrix(data = rnorm(100), nrow = 10, ncol = 10) mm <- range(v[,2])
s <- 10 * (v[,2]-mm[1])/(mm[2]-mm[1])
v2 <- cbind(v, s)

Cheers,
Ben

> Thanks,
>
> rcoder
>
>
>
> Ben Tupper wrote:
>>
>>
>> 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
>>
>> ______________________________________________
>> 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.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Mapping-data-
> onto-score-tp18463695p18475083.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.

Ben Tupper
PemaquidRiver_at_tidewater.net

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!



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. Received on Tue 15 Jul 2008 - 21:38:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Jul 2008 - 23:32:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive