File: app.R

package info (click to toggle)
r-cran-shiny 1.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,224 kB
  • sloc: javascript: 17,081; sh: 28; makefile: 21
file content (56 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (3)
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
53
54
55
56
ui <- fluidPage(
{{
# These blocks of code are processed with htmlTemplate()
if (isTRUE(module)) {
'  # ======== Modules ========
  # exampleModuleUI is defined in R/example-module.R
  wellPanel(
    h2("Modules example"),
    exampleModuleUI("examplemodule1", "Click counter #1"),
    exampleModuleUI("examplemodule2", "Click counter #2")
  ),
  # =========================
'
}
}}
  wellPanel(
    h2("Sorting example"),
    sliderInput("size", "Data size", min = 5, max = 20, value = 10),
{{
if (isTRUE(rdir)) {
  '    div("Lexically sorted sequence:"),'
} else {
  '    div("Sorted sequence:"),'
}
}}
    verbatimTextOutput("sequence")
  )
)

server <- function(input, output, session) {
{{
if (isTRUE(module)) {
'  # ======== Modules ========
  # exampleModuleServer is defined in R/example-module.R
  exampleModuleServer("examplemodule1")
  exampleModuleServer("examplemodule2")
  # =========================
'
}
}}
  data <- reactive({
{{
if (isTRUE(rdir)) {
'    # lexical_sort from R/example.R
    lexical_sort(seq_len(input$size))'
} else {
'    sort(seq_len(input$size))'
}
}}
  })
  output$sequence <- renderText({
    paste(data(), collapse = " ")
  })
}

shinyApp(ui, server)