The shinyReports package provides a simple way to render
R Markdown reports to HTML directly within a Shiny application,
displaying the result in a new browser tab and eliminating the need for
users to manually download and open report files.
First, create your .Rmd file you want to render as a
report. It must be accessible from the root directory of your
application. Ensure that you output your report as a
html_document within the YAML heading.
An example report.Rmd:
Parameters passed from the Shiny application via
renderReport() (see below) are referenced using inline R
expressions, such as params$date.
Add the reportButton() (a
shiny::actionButton download wrapper) and
renderReport functions to your UI and server, respectively
in app.R: