rtweet v0.3.6

0

Monthly downloads

0th

Percentile

Collecting Twitter Data

An implementation of calls designed to extract and organize Twitter data via Twitter's REST and stream APIs. Functions formulate GET and POST requests and convert response objects to more user friendly structures, e.g., data frames or lists. Specific consideration is given to functions designed to return tweets, friends, and followers.

Readme

rtweet: Collecting Twitter Data

CRAN\_Status\_Badge Downloads Downloads Travis-CI Build Status codecov

R client for collecting data via Twitter's REST and stream API's.

Key features

  • NEW (dev version on Github): Out of the box functionality! Start using rtweet the moment you install the package. Limited authorization access provided for users looking to test-drive the package before obtaining and using access tokens.

  • Tweet from your R console using the post_tweet() function!

  • Stream a random sample of tweets using stream_tweets(). The function default, q = "", now streams a random sample of all tweets.

  • Save as CSV: If you'd like to open Twitter data in Excel or SPSS, use the save_as_csv function.

  • Gather tweet data by searching past tweets search_tweets(), streaming live tweets stream_tweets(), collecting tweets from a user's timeline get_timeline(), or gathering all the tweets favorited by a user get_favorites().

  • Gather user data by looking up Twitter users lookup_users(). Easily return data on thousands of users.

  • Gather followers and friends data by collecting the ids of accounts following a user get_followers() or the ids of accounts followed by a user get_friends().

  • Organized and easily translatable data formats. Functions return tidy data frames ready for data analysis.

Install

To get the current released version from CRAN:

install.packages("rtweet")
library(rtweet)

To get the current development version from github:

install.packages("devtools")
devtools::install_github("mkearney/rtweet")

Getting started

  • Quick authorization method: To make your life easier, follow the recommended steps in obtaining and using access tokens. However, for a quick start (note: much slower in long term), you can also follow the instructions below.

  • First, you'll need to create a Twitter app. For the callback field, make sure to enter: http://127.0.0.1:1410.

  • Once you've created an app, record your consumer (api) and secret keys.

  • Generate a token by using the create_token() function.

twitter_token <- create_token(app = "rtweet_tokens", # whatever you named app
  consumer_key = "XZgqotgOZNKlLFJqFbd8NjUtL",
  consumer_secret = "1rDnU3H3nrxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
# I xxx'd out the secret key, but you get the idea
  • Make sure to specify twitter_token every time you use a data retrieval function, like the example below:
tw <- search_tweets("r", n = 1200, token = twitter_token, lang = "en")

Package description

More technical description: An implementation of calls designed to extract and organize Twitter data via Twitter's REST and stream API's. Functions formulate GET and POST requests and convert response objects to more user friendly structures, e.g., data frames or lists. Specific consideration is given to functions designed to return tweets, friends, and followers.

Contact

Email me at mkearney@ku.edu

To Do List

Data Analysis Helpers - Network analysis matrices and edge lists data structures - Text cleaner/utility functions - Data base management (SQL) integration for big data

API Functions

  • get_retweeters() Retrieve users retweeting a status (in progress)
  • get_list() Retrieve users in list

Vignettes

  • Word cloud, textual analysis
  • Network analysis featuring get_friends() and get_followers()

Documentation

  • More examples, more details, and list return columns with descriptions
  • Search query syntax
  • Stream syntax i.e., filter vs tracking vs location
  • Geo-based and date-specific queries

Functions in rtweet

Name Description
get_favorites get_favorites
get_followers get_followers
get_tokens get_tokens
get_trends get_trends
cleantweets cleantweets
create_token create_token
get_friends get_friends
get_timeline get_timeline
find_woeid find_woeid
format_date format_date
parse_stream parse_stream
parser parser
lookup_statuses lookup_tweets
lookup_users lookup_users
trends_available trends_available
ts_plot ts_plot
ply_friends ply_friends
post_tweet post_tweet
save_as_csv save_as_csv
next_cursor next_cursor
next_id Get value for max_id
utf8_tweets utf8_tweets
xally xally
search_users search_users
stream_tweets stream_tweets
search_tweets search_tweets
rate_limit rate_limit
rtweet rtweet
tweets_data tweets_data
users_data users_data
xanyy xanyy
xiny xiny
No Results!

Vignettes of rtweet

Name
files/created.png
files/creating.png
files/dt.png
files/hc.png
files/keys.png
files/search_tweets_plot1.png
files/ts_plot.png
rtweet.R
rtweet.Rmd
satweets.R
satweets.Rmd
timeseries.R
timeseries.Rmd
tokens.R
tokens.Rmd
No Results!

Last month downloads

Details

Type Package
Date 2016-09-26
License MIT + file LICENSE
LazyData TRUE
URL https://CRAN.R-project.org/package=rtweet
BugReports https://github.com/mkearney/rtweet/issues
RoxygenNote 5.0.1
VignetteBuilder knitr

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/rtweet)](http://www.rdocumentation.org/packages/rtweet)