在R中,我的selectInput上的默认选择将在闪亮的应用程序渲染后删除
我已经使用RStudio创建了一个基本的闪亮应用程序。我正在使用selectInput筛选仪表板上的图表。我创建的其中一个图表工作正常,应用程序加载时保留默认选择。但是,对于我的其他图表,指定的默认值在加载时短暂出现,但随后消失,并将图表和selectInput保留为空,直到手动选择过滤器在R中,我的selectInput上的默认选择将在闪亮的应用程序渲染后删除,r,shiny,selectinput,R,Shiny,Selectinput,我已经使用RStudio创建了一个基本的闪亮应用程序。我正在使用selectInput筛选仪表板上的图表。我创建的其中一个图表工作正常,应用程序加载时保留默认选择。但是,对于我的其他图表,指定的默认值在加载时短暂出现,但随后消失,并将图表和selectInput保留为空,直到手动选择过滤器 fluidRow( column(6, sidebarPanel( selectInput("indication",
fluidRow(
column(6,
sidebarPanel(
selectInput("indication",
"Indication:",
choices = data1$indication,
selected = 1))),
column(6,
sidebarPanel(
selectInput("Practice_Id",
"Practice ID:",
choices = data2$Practice_Id,
selected = 1)))
# relevant output below
output$riskBarPlot <- renderPlotly({
risk_bar_filt <- risk_bar_data %>%
filter(Practice_Id == input$Practice_Id)
risk_bar <- ggplot(risk_bar_filt, aes(x = Indication, y = Brier_Score)) +
geom_bar(aes(fill = Brier_Score, stat= "identity") +
ggplotly(risk_bar, tooltip = c("x", "y"))
})
fluidRow(
第(6)栏,
侧栏面板(
选择输入(“指示”,
“指示:”,
选项=数据1$表示,
已选定(1)),
第(6)栏,
侧栏面板(
选择输入(“练习Id”,
“机构ID:”,
选项=数据2$Practice\u Id,
所选参数=1)))
#相关输出如下
输出$riskBarPlot您可以共享data2$Practice\u Id
?Hi@Roman,您希望我以何种方式共享它?它是初始数据集@gtilston中的一个字符列。您可以共享data2$Practice\u Id
?Hi@Roman,您希望我以何种方式共享它?它是初始数据集@gtilston中的一个字符列