easyslider: easyslider: Easy sliders for shiny.

Description Details Examples

Description

Quickly add UI components by aesthetic mapping

Details

This package was written because it was frustrating to add a slider in shiny, which typically required changing code in three places: the placeholder in ui.R, a renderUI in server.R and also wiring it up to a plot by using input$thing.

Instead, we can build simple UIs more conviniently by generating the components from aesthetics. In your server function, pipe data through some filters, then generate plots and tables appropriately.

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: 

#ui.R

library(shiny)


shinyUI(fluidPage(

  # Application title
  titlePanel("Easy Slider Diamond Demo"),

  # Sidebar with easyslider controls
  sidebarLayout(
    sidebarPanel(
      easySliderUIOutput()
    ),

    # Show a plot of the filtered data
    mainPanel(
      plotOutput("distPlot")
    )
  )

))

#server.R

require(dplyr)
require(ggplot2)

library(shiny)
library(easyslider)


shinyServer(function(input, output) {

  df <- diamonds %>%
    slider2Filter(aes(depth)) %>%
    dropdownFilter(aes(clarity)) %>%
    checkboxGroupFilter(aes(cut))
    checkboxGroupFilter(aes(cut))

  output$distPlot <- renderPlot({
      df() %>% ggplot() + aes(x=carat, y=price, color=cut) + geom_point()
    })

})



## End(Not run)

nfultz/easyslider documentation built on May 31, 2019, 8:29 a.m.