small edits to keep R code in single 'group'