10:00
rstudio::conf(2022)
Building Production-Quality Shiny Applications
Eric Nantz
🤔 id
moduleServer()
: Encapsulate server-side logic with namespace applied.tagList()
of inputs, output placeholders, and other UI elementsartServer <- function(id, df, title = "My Plot") {
moduleServer(id,
function(input, output, session) {
user_selections <- reactive({
list(input1 = input$input1, input2 = input$input2)
})
output$plot1 <- renderPlot({
ggplot(df(), aes(x = x, y = y)) +
geom_point() +
ggtitle(title)
})
user_selections
}
)
}
artServer <- function(id, df, title = "Amazing") {
moduleServer(id,
function(input, output, session) {
user_selections <- reactive({
list(input1 = input$input1,
input2 = input$input2)
})
output$plot1 <- renderPlot({
ggplot(df(), aes(x = x, y = y)) +
geom_point() +
ggtitle(title)
})
user_selections
}
)
}
df
df()
user_selections
, user_selections()
Create a Shiny module for the core image viewer portion of the application in ex-1/app.R
10:00