I refer to the code example at http://shiny.rstudio.com/gallery/including-html-text-and-markdown-files.html. In my case I would like to include and R markdown file rather than a markdown.
The following is my code for ui.R
library(markdown)
shinyUI(fluidPage(
titlePanel("Tourist expenditure for the year 2012 in Malta"),
fluidRow(
column(2,
checkboxGroupInput("id1", "Analyse by",
c("Sex" = "1",
"Age Group" = "2")
)),
column(6,
h4('You entered'),
verbatimTextOutput("oid1")
),
column(4,
includeMarkdown("intro.Rmd")
)
)
))
My problem is that intro.Rmd is not compiling when embedded in shinyUI but works as expected when I choose the Knit HTML option.
Is there a way I can insert the Rmd source file directly.
Thanks.
I've had similar problems in the past, and know of two solutions:
pre-compile the .Rmd file and include the markdown or HTML using the functions you've mentioned.
call knitr from shiny within the server.R file (if the document changes due to the shiny app) and then include the compiled HTML/markdown code with includeHTML() or a similar function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With