I'm trying my hand at some reproducible research in RStudio and with Rmarkdown. Mostly because I'm too lazy to paste figures into powerpoint or word over and over. grin
One thing that I think is very important with reproducible research is recording exactly which version of the RMarkdown document produced the report. Often such documents go through many revisions, and in addition, they might pull in multiple other source files or data from the repository. So, insert the git commit SHA, and record if the repository is clean or dirty.
But despite RStudio knowing about git, it doesn't seem to make this information available through any API calls. Or am I missing something?
Other than shelling out to git by hand, what are my options?
I don't think RStudio provides this information either but you can retrieve it easily with a
system
call like this, for example :You just have to specify the format you want in
git log
and maybe fiddle a bit withgit status
to get the exact information you want.