I am writing a high school maths thesis, I use the fpp2 forecasting package. The issue is simple, I gave in input, the forecast function gave me the output for n periods in the future, I know the formula, but how can I see how R calculated my data?
The answer to your question is in the docs and the source code.
To answer your question more generally, you'll want to look up the function you applied in the docs. There, package authors usually cite their sources. With the function name (and a bit of knowledge about how R works), you can also track down the function in the repo, to see exactly how that formula is applied.
From that, you can see the repository for this package is located at
And the package documentation is located at
Now, specific to fpp2 and forecasting, you're fortunate enough to have a package written by Rob Hyndman. He and George Athanasopoulos wrote a free book on forecasting to accompany this package.