Fixed R code