Displaying 1 result from an estimated 1 matches for "lastneg".
Did you mean:
lastlog
2008 Jul 21
4
how to speed up this for loop?
Could anyone tell me a better way to achieve the output of this for loop? It
seems to run quite slow. I'm sure there must be a more consise way to sum
from FN to LN, excluding positive values, for each row.
#sum between FN and LN, excluding positive values
for(i in 1:R){
for(j in FN[i]:LN[i]){
if(Temp[i,j]<0)
sum[i] <- sum[i] + sum(Temp[i,j])}}
Cheers,
R
--
View this message in