R Markdown HTML Tab Rendering for Shiny

Render R Markdown reports to HTML and display them instantly in a new browser tab from within a 'shiny' application. Replaces file downloads with a seamless in-browser approach.


shinyReports

Render .Rmd reports directly in your browser from a shiny application - no download required.

Overview

This package adapts the Shiny -> R Markdown report generation workflow to remove the need to download a file and open it manually. shinyReports provides UI and server-side elements to knit the .Rmd file and automatically push the HTML content to a new browser tab.

Installation

Install directly from GitHub with:

# install.packages("remotes")
remotes::install_github("aes21/shinyReports")

Usage

1. Prepare the R Markdown file

Ensure your R Markdown file sits within your app structure. The YAML heading of the R Markdown file must knit to a HTML document:

---
title: ''
output: html_document
params:
  foo: NA
---

2. Add the UI element

The reportButton() function acts as a connection wrapper for shiny::actionButton to the report download in the UI.

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

3. Server-side logic

The renderReport() function contains the server-side logic to compile a .Rmd file and load the HTML content to the client.

server <- function(input, output, session) {
  renderReport(
    "knit_report",
    rmd_file = "path/to/rmarkdown.Rmd",
    title = "Report Title",
    params = list()
  )
}

The params list is passed directly through to the .Rmd file, so you can populate reports with reactive values from your app.

Demo

For an example shinyReports application, you can launch the demo directly from your R console:

library(shinyReports)

# launch example app
shiny::runApp(system.file("examples", package = "shinyReports"))

demo

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("shinyReports")

1.0.3 by Alexander Sadler, 3 months ago


Browse source code at https://github.com/cran/shinyReports


Authors: Alexander Sadler [aut, cre] , Kirsty Twigger [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rmarkdown, shiny

Suggests htmltools, knitr, testthat


See at CRAN