Hello,
I am trying to use aggregate command to get the mean of some of my data. My data is created by for loop. I have to find the correlation when the intercept from 1-5 and the coef is from 1:5 as well, so the data is repeated 5 times per each intercept. Now, I have 3 columns ( int, coef, and B00.tchsc) the intercept is repeated 5 times per each coef. I have tried to use the following command

aggregate(B01.tchsc~coef, result, mean)

and I got this error

Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'FUN' of mode 'function' was not found

Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

Without a reproducible example, I can't be sure what you're trying to do, but here's a generic example of how you can use stat_summary to calculate and plot means of your data within ggplot itself. The example below also includes 95% confidence intervals.

Mara, I have learned how to contain reprex. However, I could not find a similar data to mine yet. I woder if I can send my code as it contains the way I created the data?