-
Notifications
You must be signed in to change notification settings - Fork 1
/
testesquissebookmark.r
85 lines (70 loc) · 1.74 KB
/
testesquissebookmark.r
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
library(shiny)
library(shinyWidgets)
library(ggplot2)
library(esquisse)
ui <- function(request) {
fluidPage(
tags$h2("Filter data.frame"),
radioButtons(
inputId = "dataset",
label = "Data:",
choices = c(
"iris", "mtcars", "economics",
"midwest", "mpg", "msleep", "diamonds",
"faithfuld", "txhousing"
),
inline = TRUE
),
fluidRow(
column(
width = 3,
filterDF_UI("filtering")
),
column(
width = 9,
progressBar(
id = "pbar", value = 100,
total = 100, display_pct = TRUE
),
DT::dataTableOutput(outputId = "table"),
tags$p("Code dplyr:"),
verbatimTextOutput(outputId = "code_dplyr"),
tags$p("Expression:"),
verbatimTextOutput(outputId = "code"),
tags$p("Filtered data:"),
verbatimTextOutput(outputId = "res_str")
)
),
bookmarkButton()
)
}
server <- function(input, output, session) {
data <- reactive({
get(input$dataset)
})
res_filter <- callModule(
module = filterDF,
id = "filtering",
data_table = data,
data_name = reactive(input$dataset)
)
observeEvent(res_filter$data_filtered(), {
updateProgressBar(
session = session, id = "pbar",
value = nrow(res_filter$data_filtered()), total = nrow(data())
)
})
output$table <- DT::renderDT({
res_filter$data_filtered()
}, options = list(pageLength = 5))
output$code_dplyr <- renderPrint({
res_filter$code$dplyr
})
output$code <- renderPrint({
res_filter$code$expr
})
output$res_str <- renderPrint({
str(res_filter$data_filtered())
})
}
shinyApp(ui, server, enableBookmarking = "url")