我有下面的 Dataframe ,我想创建一个pickerInput()
,将Dimension
作为主选项,将Subdimension
作为子选项,如下所示:
pickerInput(
inputId = "p1",
label = "Select all option",
choices = list(Environmental = list("A","B","C"),
EnvironmentalB = list("A"),
EnvironmentalC = list("A","B")),
multiple = TRUE,
options = list(`actions-box` = TRUE)
)
在此 Dataframe 中,我只有Environmental
,但它们可能更多
df<-structure(list(Dimension = c("environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental",
"environmental", "environmental", "environmental", "environmental"
), Subdimension = c("A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C",
"C", "C", "C", "C", "C", "C", "C")), row.names = c(NA, -42L), class = c("tbl_df",
"tbl", "data.frame"))
1条答案
按热度按时间lsmepo6l1#
您可以使用
split
创建列表/子列表: