shiny.R renderUI checkboxGroupInput动态生成中的警告/错误
我正在shiny.R renderUI checkboxGroupInput动态生成中的警告/错误,r,dynamic,checkbox,shiny,R,Dynamic,Checkbox,Shiny,我正在server.R中运行以下代码。“COL_OP1”和“COL_OP2”是数据帧“df”中的两列(还有其他列)。我想使用uiOutput('op1')在ui.R中生成动态复选框,它工作正常,但显示警告和错误 op1几乎没有选择,基于此op2应该生成复选框 警告是 "Warning in is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'" 错误是 "Error in mapply(ids, choices
server.R
中运行以下代码。“COL_OP1”和“COL_OP2”是数据帧“df”中的两列(还有其他列)。我想使用uiOutput('op1')
在ui.R中生成动态复选框,它工作正常,但显示警告和错误
op1几乎没有选择,基于此op2应该生成复选框
警告是
"Warning in is.na(e2) :
is.na() applied to non-(list or vector) of type 'NULL'"
错误是
"Error in mapply(ids, choices, names(choices), SIMPLIFY = FALSE, USE.NAMES = FALSE, :
zero-length inputs cannot be mixed with those of non-zero length"
这是我的代码:
output$op1 = renderUI({
op1 = unique(df()$COL_OP1)
op1 = op1[order(op1)]
checkboxGroupInput('OP1', 'Choose OP1', op1, selected = op1)
})
output$op2 <- renderUI({
op2 = unique(df()[df()$COL_OP1==input$OP1,]$COL_OP2)
op2 = op2[order(op2)]
checkboxGroupInput('OP2', 'Choose OP2',op2, selected = op2)
})
output$op1=renderUI({
op1=唯一(df()$COL_op1)
op1=op1[命令(op1)]
checkboxGroupInput('OP1','Choose OP1',OP1,selected=OP1)
})
输出$op2以下代码删除了我的错误,并且我抑制了警告
output$op1 = renderUI({
op1 = unique(df()$COL_OP1)
op1 = op1[order(op1)]
checkboxGroupInput('OP1', 'Choose OP1', op1, selected = op1)
})
output$op2 <- renderUI({
if(is.null(input$OP1))
return(NULL)
op2 = suppressWarnings(unique(df()[df()$COL_OP1==input$OP1,]$COL_OP2))
op2 = op2[order(op2)]
checkboxGroupInput('OP2', 'Choose OP2',op2, selected = op2)
})
output$op1=renderUI({
op1=唯一(df()$COL_op1)
op1=op1[命令(op1)]
checkboxGroupInput('OP1','Choose OP1',OP1,selected=OP1)
})
输出$op2您能让您的示例重现吗?什么是df
?什么是supv
?看起来df$COL_OP
df()中没有任何内容是一个可修改的输出,它是一个数据框架。嗨,Stephane Laurent,我想从COL_OP列的唯一值填充复选框