R code

edits