First Commit of R Code

Contains working/teted code for Parts 1 and 2