【发布时间】:2019-01-29 18:48:39
【问题描述】:
我有一个简单的闪亮应用程序,我在其中使用numericInput()“测试”向数据框添加行。然后我将“标签”列的名称作为selectInput()“标签2”的选择。问题是,当我在表格的“标签”列中编辑名称时,selectInput() 选项不会相应更新。例如,如果我在表中将“Test 1”重命名为“Test A”,我希望它也可以在 selectInput() 中进行更改。
#ui.r
library(shiny)
library(rhandsontable)
ui <- navbarPage(
"Application",
tabPanel("General",
sidebarLayout(
sidebarPanel(
uiOutput("tex2")
),
mainPanel(
rHandsontableOutput("hot3"),
uiOutput("book12")
)
)))
#server.r
server <- function(input, output,session) {
output$tex2<-renderUI({
numericInput("text2", "#tests", value = 1, min=1)
})
output$book12<-renderUI({
selectInput("bk12",
"Label2",
choices=(rt4()$Label))
})
rt4<-reactive({
DF <- data.frame(
Label=paste("Test",1:input$text2),
stringsAsFactors = FALSE)
})
output$hot3 <-renderRHandsontable(
rhandsontable(rt4())
)
}
【问题讨论】:
-
为此查找 updateselectinput
-
当我使用 updateSelectInput() 时,我认为“运算符对原子向量无效”