Assembling an RShiny application

Our RShiny application will be able to do the following:

  • Search Twitter for a keyword/hashtag
  • Display the top 100 results
  • Show the sentiment for the top 100 tweets

Let us first load all the necessary libraries and authenticate into our Twitter account:

library(shiny)library(twitteR, quietly = TRUE)library(stringr)library(sentimentr, quietly = TRUE)library(dplyr, quietly = TRUE)consumer.key <- ""consumer.secret <- ""access.token <- ""token.secret <- ""setup_twitter_oauth(consumer.key, consumer.secret, access.token, token.secret)

Fill in your consumer.keys, secret, access.token, and token.secret.

Let us build the user interface part:

ui <- fluidPage(  navbarPage("TweetSenti",             tabPanel("Search Tweets" , textInput("search","search",value="#bladerunner") ...

Get R Data Analysis Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.