Using the SMFI5 package
After discussing the math behind interest rate models and after hard programming, let's recommend the SMFI5
package, which provides user-friendly solutions to model and simulate interest rate models (if it is modeled by an Ornstein-Uhlenbeck process), price bonds, and many other applications.
We cannot discuss it in detail, but as a short demonstration, let's call a function that simulates bond prices for different maturities:
bond.vasicek(0.5,2.55,0.365,0.3,0,3.55,1080,c(1/12, 3/12, 6/12, 1),365)
This returns a spectacular result: