R solution + tidy data set

Finished R solution and tidy data set