I have to admit my studio plotting skills are a bit weak, and I've come upon (what I think is) a fairly simple task I can't seem to solve. I am not sure how to exactly word this in a way to google this either, although I think it isn't too complicated:

basically, I have one variable, the hours of sport a person does per day, and I want to plot this in relation to age of the respondents, i.e. I want to graph a singular line with mean hours of sport on the y-axis and the age of the individuals on the x axis. I can't seem to figure this out without calculating the mean for each year group.

I know this probably isn't that tough, but I would greatly appreciate help with this. Thanks!

Could you provide us with some actual data that you are working with. If you say you only have one variable (hours of sport), how do you link this to the age of the person? I assume that data is stored somewhere else, or in the same data frame?

Please use the reprex guide to share some data and code. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here: