Displaying 1 result from an estimated 1 matches for "wmul".
Did you mean:
mul
2012 Jun 05
3
rowSums problem
...ead(temp3880W)
1 2 3 4 5 6
-0.4904454 -1.2728543 -1.5360133 -0.2687030 62.3048012 6.2610305
I've only been successful by using a for loop which is far too slow:
temp3880 <- rep(0,length(temp$Year))
for (i in 1:length(temp$Year)) {
wmul <- weight3880*as.vector(temp[i,(3:50)])
temp3880[i] <- sum(wmul)
}
This gives the result
head(temp3880)
[1] -6.936374 -9.617799 -7.227260 1.135293 8.973817 13.632454
Can anyone point out to me what is going wrong here? I've tried the first
approach with smaller data frames and vec...