added R codes