I want to create a function in my r-package that kind of looks like this:
mypackage::render_github_overview(username, repo, output = "/tmp/testDir/test.html")
This should then generate a directory containing the Rmd and the output (either html or pdf). The pseudo-content would look something like:
## Overview for Repository <repository>
User <user> has <n_repos> repos with <n_stars> stars
Now my questions are:
- How to pass arguments to the R markdown.
- Where to store the template R markdown
Regarding 1.: I think the solution might be a parameterized R Markdown document and then calling rmarkdown::render(param1...) with the parameters.
Regarding 2 my doubts are where to store the R markdown template where the gaps will be filled in. From this answer here (How to include RMarkdown file in r package?) I assume it could be in R/inst/rmd/template.Rmd or something like this. Or is there any better location?