Laying out the bond's cash flows
In the next set of exercises, you'll build a cash flow data frame as seen in the previous video.
Suppose you are considering investing in a bond that has a $100 par value, 5% coupon rate, and 5 years to maturity. The coupon rate is the interest that you earn from holding the bond, so prior to the bond's maturity you would receive $5 of coupon payments each year. At maturity, you will also receive the $100 par value back.
In this exercise, you will create a vector cf
that lays out this bond's cash flows. You will then convert this vector into a data frame, so you can add additional columns of data required in subsequent analyses.
This exercise is part of the course
Bond Valuation and Analysis in R
Exercise instructions
- Create vector
cf
that contains the bond's cash flows. Remember that cash flows are $5 for the first 4 years and $105 in the 5th year. - Use
data.frame()
to convertcf
into a data frame.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create vector of cash flows
cf <-
# Convert to data frame
cf <-
cf