【发布时间】:2018-05-23 00:12:56
【问题描述】:
我正在基于“电影”数据集在 Shiny 中创建可视化。在数据集中,除其他外,每部电影都有一个属性 plot_keywords (格式为谋杀|犯罪|警察|男人|侦探 - 5 个单词,用 | 分隔,不带空格)。我想为此属性实现一个交互式过滤器,而不考虑大写/大写字母 - 也就是说,例如,当您输入“Murder”时,Shiny 应该显示在 plot_keywords 属性的任何部分存在“murder”的所有电影。在我的代码中,如果用户没有在过滤器框中输入任何内容(默认情况下),则会显示所有电影。在'else'之后我应该使用什么功能?
部分UI代码
ui <- fluidPage(
fluidRow(
column(3,
wellPanel(
textInput("plot", "I want to watch movie about...",NULL)
)),
部分服务器代码
server <- function(input, output) {
p <- input$plot
m <- movies %>%
filter(
if(p != NULL) && (p != "")
{plot_keywords == movies$plot_keywords}
else
)`
【问题讨论】:
-
这个here有几个答案