Skip to contents

UI for the shiny module to work together with narratorServer

Usage

narratorUI(
  id,
  narration_depth = 2,
  coverage = 0.5,
  coverage_limit = 5,
  format = TRUE,
  ...
)

Arguments

id

Namespace specification

narration_depth

Parameter to control the depth of the analysis 1 for summary and 2 for detailed

coverage

Numeric portion of variability to be covered by narrative, 0 to 1

coverage_limit

Integer maximum number of elements to be narrated, overrides coverage to avoid extremely verbose narrative creation

format

If TRUE - format text with HTML tags

...

other arguments passed to glue

Value

UI

Examples

library(shiny)
library(narrator)
library(dplyr)

df <- sales %>%
  group_by(Region, Product) %>%
  summarise(Sales = sum(Sales, na.rm = TRUE))

ui <- fluidPage(
  narratorUI(id = "main")
)

server <- function(input, output, session) {
  narratorServer(
    id = "main",
    df = reactive(df),
    format = TRUE,
    summarization = "sum")
}

if (interactive()) shinyApp(ui, server)