Jojo
Jojo

Reputation: 337

How to extract tweets between a certain time period in R?

I can use the following code to extract the most recent twitter data.

library(twitteR)
tweets <- userTimeline("RDataMining", n = 3200)

url <- "http://www.rdatamining.com/data/rdmTweets.RData"
download.file(url, destfile = "./data/rdmTweets.RData")

load(file = "./data/rdmTweets-201306.RData")

But if I want to extract tweets from, for example, May-10-2016, 16:15:00 to May-10-2016, 16:16:00, what should I do please?

Upvotes: 0

Views: 9390

Answers (1)

Wayne Booth
Wayne Booth

Reputation: 422

I would replace 'userTimeline' with 'searchTwitter', which is the only real alternative for filtering by date.

From the twitteR API: https://cran.r-project.org/web/packages/twitteR/twitteR.pdf

searchTwitter('charlie sheen', since='2011-03-01', until='2011-03-02')

Hope this helps.

Upvotes: 3

Related Questions