twitter_fas: twitter_fas - Full Academic Search in Twitter Academic...

Description Usage Arguments Value Examples

View source: R/twitter_fas.R

Description

twitter_fas - Full Academic Search in Twitter Academic Research Track (API 2.0)

Usage

1
twitter_fas(query, start, end, bearer_token, max_results = 500, pause = 250)

Arguments

query

String to search for. Check https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-all for further details.

start

Starting time for full archive research. Formattad as string of form: "2021-01-01T00:00:01Z"

end

End time for full archive research. Formattad as string of form: "2021-03-01T00:00:01Z"

bearer_token

Developer Token for authorization to Academic Project. An application at developer.twitter.com is required.

max_results

The Twitter api retrieves a maximum of 500 tweets per request. This function defaults to the maximum of 500, but can be lowered by setting this argument.

pause

Pause requests, because twitter allows only 300 requests per 15 minutes. Standard is 250 requests per 15 minutes.

Value

A ressource. Actually an array of data frames (tibbles), consisting of different entities (tweets and linked entities like users, media etc.). Each entity consists of different sets of additional information like annotations, hashtags etc.:

tweets:

Tweets retrieved by your query as well as additional infomation found within these tweets, e.g.: hashtags, cashtags, mentions, annotations, urls and referenced tweets (cf. includes_retweets).

includes_retweets:

Referenced tweets with additional information, similar to those information found in tweets.

includes_media:

Media referenced in the retrieved set of tweets.

includes_places:

Places mentioned in the retrieved set of tweets.

includes_users:

Information about authors and people mentioned in tweets.

includes_polls:

Polls, which are sent with the tweets together with the different options, which were asked in these polls.

errors:

A tibble with informations on entities and keys, on which no information could be retrieved (withheld tweets, suspended users, non-public tweets etc.)

The different entitie“s each have unique ids or keys by which they are referenced. Additional tables have an parent_id key, by which these entries can be linked to their respective entity.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# You need to provide your bearer token.
# Application at developer.twitter.com required.
# You can store your bearer token in your .Rprofile in your home directory,
# creating an entry like:
# twitterBearerToken = "Your Token"

query <- "#OccupyWallStreet"
startdate <- "2012-07-12T00:00:01Z"
enddate <- "2012-07-15T00:00:01Z"
bearer_token <- readline("Please enter your bearer_token")
occupy_search <- twitter_fas(query, startdate, enddate, bearer_token)
occupy_tweets <- occupy_search$tweets$tweets
hist(occupy_tweets$public_metrics_reply_count)

## End(Not run)

mittendo/twitteRacademic documentation built on April 10, 2021, 4:37 p.m.