When I open a new RMarkdown file in RStudio, the YAML header in the default html option conveniently has the date of the file's creation already filled in. For instance:
---
title: "Default HTML output"
author: "Me"
date: "6/19/2018"
output: html_document
---
I would like to incorporate this auto-fill feature into custom html templates in my R pacakge. However I can only find guidance on printing the current date in the knitted report, whereas I want the date auto-filled into the RMarkdown YAML header.
---
title: ""
author: "Me"
date: '`r format(Sys.Date(), "%Y-%B-%d")`'
output: html_document
---
How can I enable the date to be auto-filled into the custom template, just like in the default html option?
As of 2020-08-06 the closest solution I have found is
date: "`r gsub( ' .*$', '', file.info( knitr::current_input() )$ctime)`"
This will pull the creation date from file info, which is about what i wanted.