An example of implementing credit risk in R