R code for Finance