I basically am trying to write my own function for the par value of a bond similar to my own function i wrote for the bond value above....
bondprice<- function(p, r, ttm, y) {
cf <- c(rep(p * r, ttm - 1), p * (1 + r))
cf <- data.frame(cf)
cf$t <- as.numeric(rownames(cf))
cf$pv_factor <- 1 / (1 + y)^cf$t
cf$pv <- cf$cf * cf$pv_factor
sum(cf$pv)
}
and then my final goal is to make sure my function works correct by running bondprice(p, r, ttm, y) with my values above...
I guess I am just writing my Par formula wrong and am not fully grasping this darn sequence on how to get my numbers in my formula correct, sorry if i making this confusing... I am fairly new to R and my wording and way of descrivbing might be bad...