I am working on a Shiny app that needs to have a tab showing some help info to the user. I am trying to implement this feature by using the includeMarkdown function. I have example markdown file called ‘about.Rmd’ which contains some text, graph and an equation. Knitting the file in RStudio creates a file about.md
When I use the includeMarkdown function, the equation doesn’t display properly.
I am not doing something right but I am not sure what.
Below is the reprex example of the Shiny code:
library(shiny)
library(shinydashboard)
library(markdown)
# HEADER
header <- dashboardHeader(title = NULL, titleWidth = 310, disable = FALSE)
# SIDEBAR
sidebar <- dashboardSidebar(disable = TRUE)
# BODY
body <- dashboardBody(
fluidRow(
box(width = 2, title = "Input", status = "primary",solidHeader = TRUE, collapsible = FALSE,
),
tabBox(width = 10, title = NULL, side = "left",
id = "tabset1",
tabPanel(h4("Result")
),
tabPanel(h4("About"),
includeMarkdown("about.md") #About page does not render the equation
)
)
)
) # end of BODY
ui <- dashboardPage(header, sidebar, body, skin = "green")
server <- function(input, output) {}
shinyApp(ui, server)
Apologies in advance I am not providing the full ‘about.Rmd’ test file I am using but I couldn’t figure out how to make reprex for it. I will describe its content though. I am using the standard Rmd file generated by RStudio with the following modifications:
To the yaml header I have added a line ‘keep_md: TRUE’ so that the knitting generates also about.md file. I also added an equation at the bottom of the file: $f(k) = {n \choose k} p^{k} (1-p)^{n-k}$
That equation is not displayed properly.
Thank you for the help!