Welcome to ClientVPS Mirrors

Getting Started with shinyReports

Getting Started with shinyReports

Overview

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.

Create the R Markdown template

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:

---
title: "My Report"
output: html_document
params:
  date: NA
---

Parameters passed from the Shiny application via renderReport() (see below) are referenced using inline R expressions, such as params$date.

Build your Shiny application

Add the reportButton() (a shiny::actionButton download wrapper) and renderReport functions to your UI and server, respectively in app.R:

library(shiny)
library(shinyReports)

ui <- fluidPage(
  reportButton("knit_report", label = "Generate Report")
)

server <- function(input, output, session) {
  renderReport(
    inputId = "knit_report",
    title = "My Report",
    rmd_file = "report.Rmd",
    params = list(date = Sys.Date())
  )
}

shinyApp(ui, server)

Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.

This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.