【发布时间】:2019-12-25 21:46:17
【问题描述】:
我正在尝试创建一个闪亮的应用程序,允许用户通过在 selectInput() 中选择一个数值变量和在 numericValue() 中选择一个数值来过滤数据表。 无论我尝试了什么,我都会出错
我尝试使用四种方式(input$y、get(input$y)、!!get(input$y)、!!sym(input$y))调用服务器函数中的变量,但没有得到预期结果。
server <- shinyServer(function(input, output){
output$filteredtable <- DT::renderDataTable({
newtab <- movies %>%
dplyr::filter(!!sym(input$y) < !!sym(input$numValue))
DT::datatable(data = newtab)
})
})
我希望表格对选择的输入和定义的数值做出交互反应。
input$y --> 给出一个与我们在 selectInput() 中选择的内容不交互的空表
get(input$y) --> 给出error: invalid first argument。
!!get(input$y) --> 给出error: object 'runtime' not found('runtime' 是使用文件中的数字变量)。
!!sym(input$y) --> 给出error: Only strings can be converted to symbols
【问题讨论】:
-
您能否提供您的 ui 以了解您的输入值?
标签: filter shiny dplyr shinydashboard