Learn R Programming

teal.reporter (version 0.4.0)

simple_reporter: Simple reporter module

Description

[Experimental]

Module provides compact UI and server functions for managing a report in a shiny app. This module combines functionalities for adding cards to a report, downloading the report, and resetting report content.

For more details see the vignette: vignette("simpleReporter", "teal.reporter").

Usage

simple_reporter_ui(id)

simple_reporter_srv( id, reporter, card_fun, global_knitr = getOption("teal.reporter.global_knitr"), rmd_output = c(html = "html_document", pdf = "pdf_document", powerpoint = "powerpoint_presentation", word = "word_document"), rmd_yaml_args = list(author = "NEST", title = "Report", date = as.character(Sys.Date()), output = "html_document", toc = FALSE) )

Value

NULL.

Arguments

id

(character(1)) shiny module instance id.

reporter

(Reporter) instance.

card_fun

(function) which returns a ReportCard instance, the function has a card argument and an optional comment argument.

global_knitr

(list) a global knitr parameters for customizing the rendering process.

rmd_output

(character) vector with rmarkdown output types, by default all possible pdf_document, html_document, powerpoint_presentation, and word_document. If vector is named then those names will appear in the UI.

rmd_yaml_args

(named list) with Rmd yaml header fields and their default values. This list will result in the custom subset of UI inputs for the download reporter functionality. Default list(author = "NEST", title = "Report", date = Sys.Date(), output = "html_document", toc = FALSE). The list must include at least "output" field. The default value for "output" has to be in the rmd_output argument.

Details

To access the default values for the global_knitr parameter, use getOption('teal.reporter.global_knitr'). These defaults include:

  • echo = TRUE

  • tidy.opts = list(width.cutoff = 60)

  • tidy = TRUE if formatR package is installed, FALSE otherwise

Examples

Run this code
if (interactive()) {
  library(shiny)

  shinyApp(
    ui = fluidPage(simple_reporter_ui("simple")),
    server = function(input, output, session) {
      simple_reporter_srv("simple", Reporter$new(), function(card) card)
    }
  )
}

Run the code above in your browser using DataLab