I have a data with contains measures of concentration of carbon and nitrogen from different years. It has many different measures for each year. I would like to obtain the average mean of C and N for each year, so I can plot the variation across the years.

I tried different functions that were recommended, but I can never make my code work..

[enter image description here](https://i.stack.imgur.com/HNOhP.png)