Learn R Programming

twitterreport (version 0.15.11)

tw_api_get_search_tweets: Gets status updates (tweets) via serach

Description

Using the twitter API, gets the status updates via search

Usage

tw_api_get_search_tweets(q, twitter_token, geocode = NULL, lang = NULL, locale = NULL, result_type = c("mixed", "recent", "popular"), count = 100, until = "9999-99-99", since_id = NULL, max_id = NULL, quietly = FALSE, ...)

Arguments

q
Search query
twitter_token
Token
geocode
character with 'latitude,longitude,radius', where radius units must be specified as either 'mi' (miles) or 'km' (kilometers)
lang
Restricts language
locale
Specifies the locale of the query
result_type
Either of the options especified
count
Number of statuses to get
until
character specifying the limit date (tweets before than) as YYYY-MM-DD
since_id
Returns results with an ID greater than (that is, more recent than) the specified ID
max_id
Returns results with an ID less than (that is, older than) or equal to the specified ID
quietly
Whether or not to show the 'success' message
...
Additional arguments passed to GET

Value

A data.frame with tweets (if success), with the following columns:
  • result_type
  • screen_name
  • in_reply_to_screen_name
  • user_id
  • created_at
  • id
  • text
  • source
  • truncated
  • retweet_count
  • favorite_count
  • favorited
  • retweeted
  • coordinates
  • source_name
otherwise returns NULL.

Details

Keep in mind that the search index has a 7-day limit. In other words, no tweets will be found for a date older than one week. From TwitterReturns a collection of relevant Tweets matching a specified query.

Please note that Twitter’s search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.

References

Twitter REST API (GET search/tweets) https://dev.twitter.com/rest/reference/get/search/tweets

See Also

tw_extract

Other API functions: tw_api_get_followers_ids, tw_api_get_followers_list, tw_api_get_friends_ids, tw_api_get_statuses_sample, tw_api_get_statuses_user_timeline, tw_api_get_trends_place, tw_api_get_users_search, tw_api_get_users_show, tw_api_trends_available, tw_gen_token

Examples

Run this code
## Not run: 
# # Getting the twitts (first gen the token)
# key <- tw_gen_token('myapp','key', 'secret')
# 
# # Making a query
# x <- tw_api_get_search_tweets('lovewins', key)
# ## End(Not run)

Run the code above in your browser using DataLab