Re: [R] Mapping data onto score

2008-07-16 Thread Bert Gunter
?scale -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jim holtman Sent: Wednesday, July 16, 2008 12:14 PM To: rcoder Cc: r-help@r-project.org Subject: Re: [R] Mapping data onto score Try this and see how fast it runs: # x is your input

Re: [R] Mapping data onto score

2008-07-16 Thread jim holtman
Try this and see how fast it runs: # x is your input matrix that will be processed by column # y is the scaled output matrix y <- t(apply(x, 2, function(.col){ .rang <- range(.col) (.col - .rang[1]) / (.rang[2] - .rang[1]) * 100 })) On Wed, Jul 16, 2008 at 3:01 PM, rcoder <[EMAIL PROTEC

Re: [R] Mapping data onto score

2008-07-16 Thread rcoder
Here's my code: nc<-ncol(mat) #setting end point in counter to number of cols in sm nr<-nrow(mat) mm <- array(NA, dim=c(2, nc)) #to hold min/max ranges sc <- array(NA, dim=c(nr, nc)) #to hold percentile scales for (n in 1:nc) { #now calculate respect

Re: [R] Mapping data onto score

2008-07-16 Thread rcoder
I am trying to apply the solution you mentioned to all columns in a matrix, and output the results to another matrix and append the two using the cbind function. I have written something that works, using a nested For loop to go through all the cells in the target matrix, but the trouble is that

Re: [R] Mapping data onto score

2008-07-15 Thread rcoder
Thank you Ben! This is very clear. rcoder Ben Tupper wrote: > > > 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 >>

Re: [R] Mapping data onto score

2008-07-15 Thread Ben Tupper
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 normali

Re: [R] Mapping data onto score

2008-07-15 Thread rcoder
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 Thanks, rcod

Re: [R] Mapping data onto score

2008-07-15 Thread Ben Tupper
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 th