Added solution to R file