Aggregate data set by year (year is the column name and the years are in the rows of the table)

Hi again,

To format your code as code, you can wrap it in 3 backticks (the ` symbol on your keyboard). You can read more about that in this help post: FAQ: How to make your code look nice? Markdown Formatting

The error your encountering (about not finding the %>% function) is probably due to you restarting R, and not attaching your packages again. Given that you're using dplyr functions, and the %>% function is provided by the dplyr package, make sure that you include library(dplyr) at the top of your code (i.e. before anything else) to attach the package and make it's functions available to you.