rtweet v0.4.0

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 and send API requests, convert response objects to more user friendly data structures---e.g., data frames---and provide some aesthetically pleasing visualizations for exploring the data.

Readme

rtweet

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

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

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")

Communicating with Twitter's APIs can, at times, be inconsistent. With that said, if you encounter an obvious bug for which there is not already an active issue, please create a new issue with all code used (preferably a reproducible example) on Github. For questions or other discussion, please use rtweet's Google group.

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 or via the rtweet documentation website.

  • 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. Screeshots can be found here.

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

## name assigned to created app
appname <- "rtweet_token"
## api key (example below is not a real key)
key <- "XYznzPFOFZR2a39FwWKN1Jp41"
## api secret (example below is not a real key)
secret <- "CtkGEWmSevZqJuKl6HHrBxbCybxI1xGLqrD5ynPd9jG0SoHZbD"
twitter_token <- create_token(
    app = appname,
    consumer_key = key,
    consumer_secret = secret)
  • Once twitter_token is part of your global environment, rtweet functions should find it. However, using this method, the token will not automatically load in future sessions (you'll need to create a token every time you start a new session).

  • Although not necessary, functions also accept tokens via the token argument. For example:

rt <- search_tweets("data science", n = 1000, token = twitter_token)

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 data from searches, streams, and timelines and user ids from friends and followers lists.

Contact

rtweet's Google group

Vignettes

Functions in rtweet

Name Description
lookup_coords lookup_coords
get_tokens get_tokens
get_followers get_followers
get_trends get_trends
create_token create_token
get_friends get_friends
get_timeline get_timeline
get_favorites get_favorites
find_woeid find_woeid
lookup_friendships lookup_friendships
mutate_coords mutate_coords
post_favorite post_favorite
parser parser
next_cursor next_cursor
parse_data parse_data
parse_stream parse_stream
lookup_users lookup_users
lookup_statuses lookup_tweets
post_friendship post_friendship
post_follow post_follow
post_mute post_mute
post_tweet post_tweet
save_as_csv save_as_csv
post_unfollow_user post_unfollow
search_tweets search_tweets
search_users search_users
rate_limit rate_limit
rtweet rtweet
reexports Objects exported from other packages
stream_tweets stream_tweets
trends_available trends_available
users_data users_data
ts_filter ts_filter
tweets_data tweets_data
ts_plot ts_plot
No Results!

Vignettes of rtweet

Name
files/created.png
files/creating.png
files/keys.png
files/stream-filter.png
files/stream-ts.png
auth.Rmd
intro.Rmd
stream.Rmd
No Results!

Last month downloads

Details

Type Package
Date 2017-01-17
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
NeedsCompilation no
Packaged 2017-01-18 20:40:04 UTC; mwk
Repository CRAN
Date/Publication 2017-01-18 23:54:58

Include our badge in your README

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