R code

correction