Fixed errors in R code.