这里是我的虚拟dataframe和可变社交网站,它承载了要在pickerInput in global.R中填充的独特文本
social_media <- c("Facebook","Instagram","YouTube","Snapchat","Twitter")
founder <- c("PersonA","PersonB","PersonC","personD","personE")
hits <- c(23,56,76,33,12)
DF <- data.frame(social_media, founder, hits)
social <- unique(DF$social_media)在app.R中,我实现了如下pickerInput:
library(shinyWidgets)
library(shiny)
ui <- fluidPage(
titlePanel("pickerInput"),
sidebarLayout(
sidebarPanel(
pickerInput("social","social media", choices = social, multiple = FALSE, options = list(deselectAllText = TRUE,actionsBox=TRUE))
)
,
mainPanel()
))
server <- function(input, output) {}
shinyApp(ui, server)当我运行应用程序时,列表只显示值,而不显示文本。当选择出现的时候,我会错过什么或者不去做什么呢?

发布于 2018-11-11 12:28:19
您的变量social是类型因子。这就是为什么pickerInput()显示数字输出的原因。
如果您避免创建因素:
DF <- data.frame(social_media, founder, hits, stringsAsFactors = FALSE)它将以字符的形式显示选择。
https://stackoverflow.com/questions/53247107
复制相似问题