Displaying 1 result from an estimated 1 matches for "v1_norm".
Did you mean:
tv_norm
2009 Nov 02
1
Avoiding for loops
...kes almost an hour to run on
about 30,000 rows of data in 2,500 groups.
I'm currently doing this:
-------------------------------------
for(group in unique(data$group)){
sum_V1 <- sum(data$V1[data$group == group])
for(subject in data$subject[data$group == group]){
data$V1_norm[(data$group == group & data$subject == subject)]
<- data$V1[(data$group == group & data$subject == subject)] / sum_V1
}
}
-------------------------------------
Can anyone point me to a faster way to do this in R.
Thanks!
-N