Displaying 1 result from an estimated 1 matches for "value_mean".
2011 Jun 03
0
ragged data.frame? using plyr
...ike:
set.seed(144)
sam<-sample(1000,100)
dat<-data.frame(id=letters[1:10],value=rnorm(1000),day=c(rep(1,100),rep(2,100),rep(3,100),rep(4,100),rep(5,100)))
I want to "normalise" it using the following function (unless you have
a better idea...):
adj.values<-function(dframe){
value_mean<-mean(dframe$value)
value_sd<-sd(dframe$value)
norm_value<-(dframe$value-value_mean)/value_sd
score_scale<-100
score_offset<-1000
scaled_value<-norm_value*score_scale+score_offset
names(scaled_value)<-dframe$id
return(scaled_value)
}
score_out<-ddply(dat,.(day...