searchTweets: Search tweets

View source: R/searchTweets.R

searchTweetsR Documentation

Search tweets

Description

This function will search for related tweets that match a specified string.

Usage

searchTweets(searchString, resultType = "mixed", count = 5)

Arguments

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

Details

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

Value

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

Author(s)

Ao Tang

References

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets

Examples

##search for the hashtag #canada

# searchTweets('#canada', resultType = "popular", count = 15)

tangaot/twitterapiR documentation built on March 24, 2022, 12:40 p.m.