r code edits