Once, I used Rmarkdown template custom format for this purpose.
Basically, I made a wrapper ,like in the example, of html_document fixing some of the parameter directly in the function, and exposing some with default or not.
When this format was used, you only need to specify in yaml those arguments which were in the function. All the other yaml parameters are taken care of inside the function.
With this I think you can even abstract date if it is inside the function.
Problem is for you: it does not really abstract the custom function...
However, did you try this approach to abstract some parameters and even fix default ?
Example from Rmarkdown website:
quarterly_report <- function(toc = TRUE) {
# get the locations of resource files located within the package
css <- system.file("reports/styles.css", package = "mypackage")
header <- system.file("reports/quarterly/header.html", package = "mypackage")
# call the base html_document function
rmarkdown::html_document(toc = toc,
fig_width = 6.5,
fig_height = 4,
theme = NULL,
css = css,
includes = includes(before_body = header))
}
fig_width, fig_height, theme, css, and includes are set once inside the function and can't be change by a yaml in the Rmd document. It is not customisable by the user for this custom format (and it is the purpose)
Only argument that can be change is the toc, and it is set to TRUE by default, if none is provided
---
title: "Untitled"
output: mypackage::quarterly_report
---
There is also a vignette about this.