I want to create a basic shiny app wherein I can type a keyword in the text input box and when i click submit the output should be a Data table of the recent tweets having the keyword typed in the text input box. I also need to find a way to automatically enable the handshake between my app and twitter using setup_twitter_oauth
. I have created the following app.R
file
library(shiny)
library(twitteR)
ui <- fluidPage(
titlePanel("Basic Twitter Search App"),
textInput("twitter", "Search Keyword"),
actionButton("click", label = "Search Tweets"),
dataTableOutput("table")
)
server <- function(input, output){
source(file = 'oauth.RData') #file containing the credentials
output$table <- renderDataTable
(
{
observeEvent(input$twitter, {searchTwitter(input$twitter, n=1500)
})
})
}
shinyApp(ui = ui, server = server)
but when I run the code (Run App), the following error occurs :
Error in orig(name = name, shinysession = self) : unused arguments (name = name, shinysession = self) Warning: Unhandled error in observer: client error: (400) Bad Request observeEvent(input$twitter)
server <- function(input, output){
source(file = 'oauth.RData') #file containing the credentials
output$table <- renderDataTable({
test <- searchTwitter(input$twitter, n=1500)
return(test)
})
}
This should work as long as searchTwitter returns a df or a matrix