Added R Code

The base R code