Yes...as @nirgrahamuk and @jms have noted, RMarkdown notebooks are the ideal medium for this.
If you're not thinking about keeping track of things, you won't keep track of things.
—Karl Broman
As well, I'd encourage you to read Randy Au's recent blog post " Let's Get Intentional About Documentation"
He makes the case that "documentation" is a loaded term and we'd be better served if we think about "recordkeeping" first.
There are three things to capture in your recordkeeping:
-
The why and how of the decisions made
-
How things work together (for this, I would stress that you include the details of the computational environment...which version of R and the packages you're using, folder structure, etc)
-
How to make changes