I want to do linear regression over the years.

We need same sample data and more of your code. Please look at
FAQ: How to do a minimal reproducible example ( reprex ) for beginners for some suggestions.