R Code for Research Paper