I have two vectors CF <- c ( 500,500,200) rates <- c( 0.1, 0.15 , 0.2)
the vectors can vary in length and in values, the equation would be: NVP = (CF1*(1+R1)^-1) + (CF2*(1+R2)^-1*(1+R1)^-1) + (CF3*(1+R3)^-1*(1+R2)^-1*(1+R1)^-1)
I have tried this:
for(n in 1:length(CF)) { if ( length(R)==1) { van <- van + CFFC[n] * ((1 + R) ^ -n) } else { aux [n] <- CF[n]* ((1+ R[c(1:n)])^ -1) } }
Please help, this is my first time programming
https://stackoverflow.com/questions/67030176/how-can-i-calculate-the-npv-net-present-value-with-different-rates April 10, 2021 at 10:04AM
没有评论:
发表评论