Shiny flexdashboard和updateSelectInput--赢得';I don’我这辈子都不工作

Shiny flexdashboard和updateSelectInput--赢得';I don’我这辈子都不工作,shiny,flexdashboard,Shiny,Flexdashboard,尝试使selectInput的选择范围取决于第一个selectInput的值 柔性板标题看起来像: --- title: "blabla" output: flexdashboard::flex_dashboard: orientation: rows social: menu source_code: embed theme: cerulean runtime: shiny --- 下面的代码已编译但不起作用,它位于.sidebar块中。我试图使用input$b

尝试使selectInput的选择范围取决于第一个selectInput的值

柔性板标题看起来像:

---
title: "blabla"
output:
   flexdashboard::flex_dashboard:
   orientation: rows
   social: menu
   source_code: embed
   theme: cerulean
runtime: shiny
---
下面的代码已编译但不起作用,它位于.sidebar块中。我试图使用input$book以交互方式更改“chapter”selectInput的范围。不幸的是,updateSelectInput()似乎什么都不做

# Inputs {.sidebar data-width=150}

```{r}
selectInput("book", label = "libro", choices = c("dq1605", "dq1615"), selected="dq1605")
selectInput("chapter", label = "capítulo",choices = 0:54, selected=0)

observeEvent(input$book, {
   y <- input$book
   if (is.null(y)) y <- "dq1605"
   chs <- if(y=="dq1605") 0:54 else 0:74
   updateSelectInput(session,"chapter",choices = chs)
})
```
事实上,这对我很有用。 我所更改的只是“selected=max(chs)”,以便更容易地查看它是否有效

也看不到你的软件包比我的旧

---
title: "blabla"
output:
   flexdashboard::flex_dashboard:
   orientation: rows
   social: menu
   source_code: embed
   theme: cerulean
runtime: shiny
---

# Inputs {.sidebar data-width=150}

```{r}
selectInput("book", label = "libro", choices = c("dq1605", "dq1615"), selected="dq1605")
selectInput("chapter", label = "capítulo",choices = 0:54, selected=0)

observeEvent(input$book, {
   y <- input$book
   if (is.null(y)) y <- "dq1605"
   chs <- if(y=="dq1605") 0:54 else 0:74
   updateSelectInput(session, "chapter", choices = chs, selected = max(chs))
})
```
---
标题:“布拉布拉”
输出:
flexdashboard::flex_仪表板:
方向:行
社交:菜单
源代码:嵌入
主题:蔚蓝
运行时间:闪亮
---
#输入{.sidebar数据宽度=150}
```{r}
selectInput(“book”,label=“libro”,choices=c(“dq1605”,“dq1615”),selected=“dq1605”)
选择输入(“chapter”,label=“capítulo”,choices=0:54,selected=0)
ObserveeEvent(输入$book{
Y
---
title: "blabla"
output:
   flexdashboard::flex_dashboard:
   orientation: rows
   social: menu
   source_code: embed
   theme: cerulean
runtime: shiny
---

# Inputs {.sidebar data-width=150}

```{r}
selectInput("book", label = "libro", choices = c("dq1605", "dq1615"), selected="dq1605")
selectInput("chapter", label = "capítulo",choices = 0:54, selected=0)

observeEvent(input$book, {
   y <- input$book
   if (is.null(y)) y <- "dq1605"
   chs <- if(y=="dq1605") 0:54 else 0:74
   updateSelectInput(session, "chapter", choices = chs, selected = max(chs))
})
```