我正在使用 shinyWidgets 包中的 sliderTextInput 小部件。滑块工作正常,但我的滑块标签未显示。代替我的标签,显示“[object Object]”。我该如何纠正这个问题?这是我的代表。
# reprex for slider problem
library(shiny)
library(shinyWidgets)
dateD <- seq.Date(as.Date("2017-01-01"),
Sys.Date()-1,by="day")
dateC <- character()
for (i in 1:length(dateD)) {
dateC[i] <- format(dateD[i],"%b %d, %Y")
}
strtRang <- c(dateC[1],dateC[length(dateC)])
ui <- fluidPage(
sliderTextInput("Dates",
label="Choose starting and ending dates:",
choices=dateC,
selected=strtRang,
dragRange = TRUE,
width="100%")
)
server <- function(input, output,session) {
observe({
updateSliderTextInput(session,inputId="Dates",
tags$b(tags$span(style="color:blue",
label="Choose starting and ending dates:")),
choices = dateC,
selected=strtRang)
})
}
shinyApp(ui, server)