Added R code for the functions