Call a Rmarkdown report in the shiny application

2019-04-02 09:33发布

问题:

I have a shiny application that read a csv file and clean the data and add few columns, ... (I used this example to create the app). At the end the application save the cleaned data (output.csv) in the log folder within the application folder.

I also design a Rmd file which is in the shiny application folder. The Rmd file uses the output file (log/output.csv).

I would like to call the Rmd file to show the report after saving the (output.csv), How can I do it?

回答1:

I found the solution as follow. Just include the following code lines in your application:

uo.R:

mainPanel(
      uiOutput("report")
    )

server.R:

output$report <- renderUI({
    includeMarkdown("Report1.Rmd")
  })