search for: theycan

Displaying 1 result from an estimated 1 matches for "theycan".

Did you mean: thecap
2007 Feb 02
1
Another loop - deloop question
...re more efficient. Right now I have the following setup: p is a vector of length m g is a list of length n, g[[i]] is a vector whose elements are indices of p, i.e., integers between 1 and m inclusive); the g[[i]] cover the full set 1:m, but they don't have to constitute an exact partition, theycan overlap members. y is another list of length n, each y[[i]] is a vector of the same length as g[[i]]. Now I build up the vector p as follows: p=rep(0,m) for(i in 1:n){p[g[[i]]]=p[g[[i]]]+y[[i]]} Can this loop be vectorized? Thanks! -- TMK -- 212-460-5430 home 917-656-5351 cell