R: Removed a code duplicate