r - 当 selectInput() 改变时从 sliderInput() 更改为 numericInput()
问题描述
这很笼统,但是使用这种方法(见下文)在原始代码中使用它时会引发多个关于 if 语句的警告(这里太长了,无法展示)。那么,是否有任何适当的方法可以从何时切换sliderInput()
到更改?非常感谢...numericInput()
selectInput()
编辑:示例未正确复制。代码现在返回警告。错误显然
value = c(0, 10)
在于 innumericInput()
,这当然需要一个值。原谅我跳进去...
library(shiny)
ui <- fluidPage(
selectInput("option", "Select option", c("Slider", "Numeric")),
uiOutput("op")
)
server <- function(input, output, session){
output$op <- renderUI(
if(input$option == "Slider"){
sliderInput(inputId = "sip",
label = "Slider",
min = 0,
max = 10,
value = c(0, 10))
} else {
if(input$option == "Numeric"){
numericInput(inputId = "nip",
label = "Numeric",
min = 0,
max = 10,
value = c(0, 10)) #Single value required
}
}
)
}
shinyApp(ui = ui, server = server)
解决方案
推荐阅读
- python - Python 文档中“mixin 方法”的含义
- python - 当我求幂时,程序抛出值错误,Python 3
- spring-boot - Keycloak:将 ldap 组映射到 springboot 角色
- r - 错误:在 gtsummary 中使用 srvyr 和 tbl_svysummary 时,$ 运算符对原子向量无效
- hadoop - 使用 Hadoop 运行时 NFS 导出列表为空
- python - 在不使用 itertools 的情况下生成组合
- vue.js - Gitlab 生产环境变量
- java - 根据 get Response 制定一些逻辑
- javascript - 动态规划在二维数组中找到具有约束的最大路径
- javascript - 防止重新生成 S3 预签名 URL