Hi, All,
I wonder anyone can help me find a faster algorithm to
get the values of unique ID (most ID has 2-3 values,
varies).
My data looks like:
ID Values
1 250
2 300
1 251
3 5000
4 600
10 521
3  5500
I would like output to look like:
ID, avg(values), stdev(values), value 1,val 2,val3,...

I used 2 for loops trying to get the values
for (i in 1:n){
  value <- NULL
  for(j in 1:m){
    if(data[j,1] == uniqueid[i]){
         value <- c(value, data[j,2])
          ....
    }
  }
}
Since both n and m are about 10000, the algorithm is
really slow.  I believe there is some function out
there that can do better than this in R. 

Thanks

-Jindan

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to