searchTweets | R Documentation |
This function will search for related tweets that match a specified string.
searchTweets(searchString, resultType = "mixed", count = 5)
searchString |
A search string of 100 characters maximum, including operators. |
resultType |
If not NULL, returns filtered tweets as per value. See details for allowed values. |
count |
If not NULL, restricts the maxumin number of tweets to return. Default is 5, up to a maximum of 100 |
This function will return any authorized tweets that matches the search conditions. Authorized tweets are public tweets, as well as those protected tweets that are authenticated by registerTwitterOAuth, which users can use. Please note that Twitter's search service and, by extension, the Search API are not meant to be exhaustive.
The searchString
is always required. It can contain hashtags in order to search specified tags in Twitter.
The resultType
specifies the type of search results you want. The current default is "mixed." Valid values include:
mixed
: includes both popular and real time results in the response
recent
: returns only the most recent results in the response
popular
: returns only the most popular results in the response
A DataFrame that contains the following columns:
created_time |
The date and time the tweet was created |
user_name |
The name of the user |
user_screen_name |
The screen name of the user |
user_followers_count |
The number of followers of the user |
text |
The text of the tweet |
truncated |
Indicates if the tweet is truncated |
favorited |
Indicates if the tweet is favorited |
retweeted |
Indicates if the tweet is retweeted |
favorite_count |
The number of times the tweet was favorited |
retweet_count |
The number of times the tweet was retweeted |
Ao Tang
https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets
##search for the hashtag #canada # searchTweets('#canada', resultType = "popular", count = 15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.