Final R file

Added the rest of the code for this project.