search for: naindex

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

Did you mean: anindex
2011 Jan 17
2
Difficult with round() function
...sitions[1:(i-1)]))/length(benchmarks) } } #AND UPDATES STARTVEC INDECES AND FRACTION MULTIPLIERS if(max(positions) != length(benchmarks)) indeces <- c(indeces, max(indeces) + 1) if(sum(fracs) != 1) fracs <- c(fracs, 1 - sum(fracs)) fromVals <- startVec[indeces] if(any(is.na(fromVals))){ NAindex <- which(is.na(fromVals)) if(sum(Fracs[-NAindex]) >= 0.5) shortVec[j] <- sum(fromVals*fracs, na.rm=TRUE) else shortVec[j] <- NA }else{shortVec[j] <- sum(fromVals*fracs)} } return(shortVec) } for the simple test case test <- gridResize(startVec = c(2,4,6,8,10,8,6,4,2), to = 7) t...