| Title: | R Markdown HTML Tab Rendering for Shiny |
|---|---|
| Description: | 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. |
| Authors: | Alexander Sadler [aut, cre], Kirsty Twigger [ctb] |
| Maintainer: | Alexander Sadler <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.3 |
| Built: | 2026-06-29 19:59:39 UTC |
| Source: | https://github.com/cran/shinyReports |
Server-side logic to compile .Rmd and send HTML to client.
renderReport( inputId, title = "Report", rmd_file, params = NULL, envir = parent.frame() )renderReport( inputId, title = "Report", rmd_file, params = NULL, envir = parent.frame() )
inputId |
The input slot that will be used to access the value. |
title |
The title to label the report tab. |
rmd_file |
The input file to be rendered (.Rmd). |
params |
A list of named parameters that override custom params specified within the YAML front-matter. |
envir |
The environment in which the code chunks are to be evaluated during knitting. |
No return value, called for side effects. Registers a
shiny::observeEvent that listens for the specified inputId
button click and renders the given .Rmd file to a temporary HTML
file, the content of which is sent to the client via a custom 'shiny'
message ("openWindow") to open a new browser tab/window. If the
render fails, a 'shiny' error notification is displayed.
if (interactive()) { server <- function(input, output, session) { renderReport( inputId = "knit_report", title = "My Report", rmd_file = "report.Rmd", params = list(date = Sys.Date()) ) } }if (interactive()) { server <- function(input, output, session) { renderReport( inputId = "knit_report", title = "My Report", rmd_file = "report.Rmd", params = list(date = Sys.Date()) ) } }
Modifies shiny::actionButton() to generate and open an R
Markdown report in a new window tab.
reportButton(inputId, label = "View Report", icon = NULL, ...)reportButton(inputId, label = "View Report", icon = NULL, ...)
inputId |
The |
label |
The contents of the button or linkâusually a text label, but you could also use any other HTML, like an image. |
icon |
An optional |
... |
Named attributes to be applied to the button or link. |
A shiny.tag.list object definition (from
tagList) containing two components:
A singleton <script> tag, injected
into the page <head>, that registers a custom 'shiny' message
handler ("openWindow") for opening the rendered report in a
new browser tab/window.
A actionButton with the argument definitions
of inputId, label and icon.
The return value should only be included under a
fluidPage 'shiny' definition.
if (interactive()) { ui <- fluidPage( reportButton( inputId = "knit_report", label = "Generate Report" ) ) }if (interactive()) { ui <- fluidPage( reportButton( inputId = "knit_report", label = "Generate Report" ) ) }