admin管理员组文章数量:1399949
I've scoured SO for the answer to this question, and I have tried solutions from multiple threads, so I am not sure what I continue to do wrong with this. I am trying to make a master filter list for my app. Those filters will then feed into a SQL query so I can load the necessary data. I cannot get the filters to work correctly when I put them into a separate module. I've made a minimal reproducible example here that should just print out what is stored in my filters, which is how I've been troubleshooting. This code gives me the error: cannot find function "filters"
. When I remove the parentheses after filters
in testServer
, I get $options reactive({ input$options })
library(shiny)
library(shinycssloaders)
filtersUI <- function(id) {
ns <- NS(id)
tagList(
# Program input ------
selectInput(
inputId = ns('options'),
label = 'Select program(s):',
choices = c('A','B','C','D'),
multiple = TRUE
)
)
}
filtersServer <- function(id){
moduleServer(id, function(input,output,session){
return(
list(
options = reactive({input$options})
)
)
})
}
testUI <- fluidPage(
filtersUI('inputs'),
textOutput('filters') %>%
withSpinner()
)
testServer <- function(input,output,session) {
filters <- filtersServer('inputs')
output$filters <- renderPrint({
filters()
})
}
shinyApp(ui=testUI,server=testServer)
本文标签: Getting inputs from a separate module in R ShinyStack Overflow
版权声明:本文标题:Getting inputs from a separate module in R Shiny - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744241826a2596824.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论