-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
28 lines (25 loc) · 670 Bytes
/
Copy pathapp.R
File metadata and controls
28 lines (25 loc) · 670 Bytes
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
#' @import shiny purrr
filterApp <- function() {
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
datasetInput("data", is.data.frame),
textOutput("n"),
chooseVarInput("choose_var"),
filterUI("filter"),
),
mainPanel(
tableOutput("table")
)
)
)
server <- function(input, output, session) {
df <- datasetServer("data")
choose_var_data <- chooseVarServer("choose_var", data = df)
filter <- filterServer("filter", df)
output$table <- renderTable(df()[filter(),, drop = FALSE])
output$n <- renderText(paste0(sum(filter()), " rows"))
}
shinyApp(ui, server)
}
filterApp()