I have an R markdown template (skeleton.Rmd
and template.yaml
) that I would like to use. The various documents that describe the creation of templates (e.g., here, here, and here) all say that templates are either created in the working directory (e.g., by using the use_rmarkdown_template() function) or in the inst/rmarkdown/templates
directory of a package (I assume the package your are developing).
I work on a Mac, and my working directory is usually the Desktop (I know - someone is going to say this is bad for whatever reason, but it's the way my broken brain works), and I don't want the inst/rmarkdown/templates
directory on the Desktop.
I have a large number of templates installed (i.e., that are available from File
-> New File
-> R Markdown
-> From Template
), but I cannot seem to find anything related to those names when I search for them.
EDIT: Here is a solution that works. I don't know if it's kosher or not, but I get the behavior I'm after.
The path is: Library/Frameworks/R.framework/Versions/[*note1*]/Resources/library/rmarkdown/rmarkdown/templates/[*HERE*]
Note 1: If you have multiple versions of R installed, pick the right one. I'm not sure if "Current" works or not. Obviously no brackets or asterisks.
Note 2: The double rmarkdown/rmarkdown
is not a typo.
At this point, you take the directory that contains just your template (i.e., the template.yaml
file and the subdirectory called skeleton
with the file skeleton.Rmd
in it) and put it where I put HERE (again, no brackets or asterisks).
Restart R. When you open a new markdown file, your template will be available in the list - no unique working directory and no package.
If anyone knows of problems with this, please let me know. Otherwise, I think we should propagate this! (I don't have a solution for Windows, but I'm sure it would be similar.)