我正在尝试让用户上传.csv文件,然后获取该.csv文件的列(因子)并创建用户输入以确定将为数据框选择该字段中的哪些唯一名称 .

所以,如果我有以下示例data.frame:

COURSE    VALUE
      1     A        7
      2     A        9
      3     B        10
      4     C        12
    ....

我想过滤一个带有A,B和C的复选框列表 . 然后用户可以选择说A和C,并且数据框将仅针对具有A和C的行进行过滤 . 下面的代码部分是只是为了试图获取用户输入的复选框 .

加载csv文件很好 . 它是加载到model.data0()中的反应部分 . 但是,我得到一个关于长度(0)的错误 . 下面的代码来自server.r文件,而ui.r只有一个RenderU {('coose_course)} .

output$choose_course <- renderUI({
  # If missing input, return to avoid error later in function
  if(is.null(input$model.input))
    return()

  # Get the data set with the appropriate name
  course.names <- as.vector(unique(select_(model.data0(),"COURSE")))

  # Create the checkboxes and select them all by default
  checkboxGroupInput("courses", "Choose courses", 
                     choices  = course.names,
                     selected = course.names)
})