reactor: Reactor - a lite-GUI for R based in Shiny

Description Usage Arguments Value Functions Examples

Description

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.

Usage

1
2
3
4
5
reactorUI(namespace, layout = c("vertical", "horizontal"))

reactorModule(namespace = NULL, directory = NULL, envir = NULL)

reactorCore()

Arguments

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 vertical or horizontal. Default vertical. Adjusting the split should be useful in fitting reactor to different UI layouts in Shiny applications.

directory

character string The directory where reactor should save reports. Default NULL which will have reactor generate a folder in the user's Documents directory. If write permissions do not allow for creation of a folder, reactor will attempt to create a temporary folder. If that should fail, the user will be prompted to manually create a folder and then relaunch the app. Value passed can be a reactive expression or a static value

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, environment() or the global environment globalenv(). However, for most uses access to the server domain, activated through the default entry, will be best.

Value

A reactor module, either UI or server

Functions

reactorUI()

The UI component, with various layout options

reactorModule()

Load the reactor server module

reactorCore()

A small Shiny app to demonstrate reactor

Examples

 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)

klaukh/reactor documentation built on May 8, 2019, 1:13 p.m.