MaelKubli / RTwitterV2

R functions for Twitter's v2 API
MIT License
46 stars 6 forks source link

Retweets #4

Closed craterghost closed 3 years ago

craterghost commented 3 years ago

Is there a way to exclude retweets from the full_archive_search?

MaelKubli commented 3 years ago

Yes there is a simple way to exclude retweets in queries. You need to add the following Argument: -is:retweet The full documentation for queries can be found here: https://developer.twitter.com/en/docs/tutorials/building-high-quality-filters

craterghost commented 3 years ago

Thanks for the answer! Could you maybe use it in an example with the search_full_archive() function? It would really help a lot. Btw, you did a great job on the package.

MaelKubli commented 3 years ago

Sure an easy example would be something like this:

` library(RTwitterV2)

To exclude retweets just add -is:retweet to the query itself:

query <- "#Biden OR #Trump -is:retweet"

lower <- "2020-06-01T00:00:01Z" upper <- "2021-06-01T00:00:01Z"

tmp <- full_archive_search(token = Bearer_Token, search_query = query, n = 2500, start_time=lower, end_time=upper, JSON = FALSE)

unique(tmp$is_retweet) `