We are analyzing fixed effects heterogeneity across years of a panel database ("mydata") containing values of an economic explained value depending on 12 independent variables. Data correspond to the period 2007-2017 and 142 countries. We use function plotmeans from package gplots being the script as follows:
plotmeans(D ~ Year, main="Heterogeineity across years", data=mydata)
We obtain the graph hereunder:

Is there any function/script on R that can fit the obtained plot into a quadratic curve providing its equation coefficients?

A quadratic fit is quite straightforward in R using the linear model
lmfunction with a quadratic term. TheI()function (as is) is necessary to inhibit symbolic interpretation of the "^" operator and simplification the quadratic term.summary(orcoef) print the coefficients andpredictcan be used to plot the curve:To do the same with
plotmeansit is necessary to adjust the x scale.