In the flexdashboard package, chart headers (headers for cells in the grid) are executed using three hash marks (for example, ### Chart title here
). I want to pass the reactive value to this header. You can usually define the user interface and click on ( https://stackoverflow.com/a/1671895/... ), but hash tags are what tells knitting that this is the name of the diagram. I also thought about passing reactive values using inline code (like `r CODE HERE`
), as shown in MWE below. You can use inline text for chart titles, but not when it contains reactive values. This results in an error:
Error in as.vector: cannot coerce type 'closure' to vector of type 'character'
In this case, how can I pass the month in the form of chart.title?
MWE (deleting the last line allows this to be done)
---
title: "test"
output: flexdashboard::flex_dashboard
runtime: shiny
---
```{r}
library(flexdashboard)
library(shiny)
```
Inputs {.sidebar}
-------------------------------------
```{r}
selectInput(
"month",
label = "Pick a Month",
choices = month.abb,
selected = month.abb[2]
)
getmonth <- reactive({
input$month
})
renderText({getmonth()})
```
Column
-------------------------------------
source
share