Description Usage Arguments Value Functions Examples
Reactor provides users an ability to leverage and debug functions and objects
inside a Shiny application without using standard debugging functions like browser()
,
debug()
, and breakpoints. Reactor provides the ability to run both R and Markdown
code, save the code, and to generate reports in multiple formats.
1 2 3 4 5 | reactorUI(namespace, layout = c("vertical", "horizontal"))
reactorModule(namespace = NULL, directory = NULL, envir = NULL)
reactorCore()
|
namespace |
character string Standard namespace convention for Shiny modules.This value will be appended onto all UI ID's, so choose a namespace value that does not conflict with other UI objects in your application. |
layout |
character string Whether the split between the UI (user interface) pane and the rendering pane should be
|
directory |
character string The directory where reactor should save reports. Default |
envir |
For advanced users The environment where R scripts and reports should be evaluated.
Defaults to the primary server environment of the Shiny session, providing access to all session objects.
Other common options would be the current calling environment, |
A reactor module, either UI or server
The UI component, with various layout options
Load the reactor server module
A small Shiny app to demonstrate reactor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
# View the code from the example app
# file.show(system.file('example/app.R', package = 'reactor'))
library(reactor)
# Define UI for application that draws a histogram
ui <- navbarPage(title = 'Reactor Test',
tabPanel('Old Faithful',
# Application title
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
titlePanel("Old Faithful Geyser Data"),
plotOutput("distPlot")
)
)
),
tabPanel('Reactor', reactorUI('faithful'))
)
# Define server logic required to draw a histogram
server <- function(input, output) {
data <- reactive({ faithful })
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- data()[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
# add the reactor module
r <- reactorModule('faithful')
}
# Run the application
shinyApp(ui = ui, server = server)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.