我已经开始创建一个Web应用程序使用闪亮的地方,用户输入一个搜索字词和包含该字词的推文返回。停止功能开始有光泽,直到按下按钮
当我加载此应用程序searchTwitter
功能自动开始,并在主面板上有错误:Error: You must enter a query.
搜索项在TextInput框中输入并有一个提交按钮。你可以输入一个术语,它可以正常工作,但我不希望错误成为用户看到的第一个东西。
ui.R:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Twitter Generator"),
sidebarPanel(
textInput("search", "Search Twitter For:", value = ""),
submitButton("Search")
),
mainPanel(
h3(textOutput("search")),
tableOutput("view"),
)
))
server.R:
library(shiny)
library(twitteR)
shinyServer(function(input, output) {
datasetInput <- reactive(function(){
rawTweets <- twListToDF(searchTwitter(paste(input$search)))
rawTweets$cleanText <- as.vector(sapply(rawTweets$text, CleanTweet))
rawTweets[, colnames(rawTweets) != "created"]
})
output$search <- reactiveText(function() {
input$search
})
output$view <- reactiveTable(function() {
head(datasetInput())
})
})
感谢您的帮助
我的问题在这里得到解答:http://stackoverflow.com/questions/15840803 – user1414259