working R code with tidy data set file