Reputation: 37
How does one append the date in R Markdown to include say both the date created and the date last rendered to be on two separate lines. For example, I'd like the output on the first page to be:
Created on: October 21, 2018
Last Updated on: October 22, 2018
The Code I'm using is:
date: "Created on October 21, 2018" #note two blank spaces before the next line
'`r paste("Last Updated on: ",format(Sys.Date(),"%B %d,%Y"))`'
Upvotes: 0
Views: 7222
Reputation: 368181
Keep it simpler -- just put the fixed text inside the paste()
function. In other words, make it for example
date: '`r paste("First created on Oct 01, 2018. Updated on", Sys.Date())`'
which would work as follows. You have all the control you need inside the
paste()
, so format(Sys.Date(), "%b %d, %Y")
creates Oct 21, 2018
.
Upvotes: 4