While this works as expected (adding the Date on the right hand side of the navbar):
---
output:
flexdashboard::flex_dashboard:
orientation: rows
theme:
version: 3
bootswatch: flatly
vertical_layout: fill
navbar:
- title: !expr Sys.Date()
href: "#"
align: right
---
this one fails (unnecessary code stripped), and I have no idea why, given that both !expr
bits are valid R code, which work when pasted manually to the console.
navbar:
- title: !expr format(Sys.Date(), "Created on: %Y-%m-%d")
href: "#"
align: right
The latter throws the following error:
Error in yaml::yaml.load(..., eval.expr = TRUE) : Could not parse expression: format(Sys.Date(), "Created on Calls: ... parse_yaml_front_matter -> yaml_load -> Execution halted
It seems that the colon followed by a whitespace :
is the culprit. Removing this space renders the document just fine. This seeme like a bug, or at least an undocumented restriction. For now I found an hack by replacing the colon by its Unicode representation:
navbar:
- title: !expr format(Sys.Date(),"Created on\U003A %Y-%m-%d")