【发布时间】:2013-11-21 22:23:37
【问题描述】:
我在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)
})
【问题讨论】:
-
您能否让您的示例可重现?
df是什么?supv是什么? -
看起来
df$COL_OP中什么都没有 -
df() 是一个recative输出,它是一个数据框
-
嗨 Stephane Laurent,我想从 COL_OP 列的唯一值填充 CheckBoxes