update R code for readability