我正在尝试在Shiny中创建一个交互式表格,对于其中一个列,我希望可以从下拉菜单中选择多个值。
一段简单的代码(包裹' rhandsontable'是必需的):
require(rhandsontable)
DF = data.frame(val = 1:10,
factor = factor(rep("h1",10), levels = c("h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9","h10","h11","h12","h13","h14","h15","h16","h17","h18","h19","h20","h21","h22","h23","h24"), ordered = TRUE )
)
rhandsontable(DF, rowHeaders = NULL, width = 550, height = 300)
我的目标是能够在“因素”中选择多行。列,以便该行可以读取,例如:' h1',' h2',' h3'。
我想知道,如果可能的话;如果我将输入作为字符串,我可以解决它,但是用户必须手动输入所需的值,这会增加错误的可能性并降低用户友好性。
提前致谢,Matija
PS:我已经厌倦了在hot_col上设置类型来选择' (见下面的代码),这应该解决问题(我认为),但它甚至不执行......
rhandsontable(DF, rowHeaders = NULL, width = 550, height = 300) %>%
hot_col(col = "factor", type = "select", source = LETTERS)