added R codes to midterm submissions