Ravi
Ravi

Reputation: 119

R Twitter API - twitteR - Larger Radius Results in Less Tweets

I am trying to use the twitteR package to gather tweets from the Twitter API. However, it seems that the radius parameter for the geocode setting is behaving oddly.

I would like to ultimately gather tweets from all over the USA, so I tried to select a latitude/longitude in the middle of the country, with a radius big enough to cover the USA. However, it seems that the number of tweets I get first increases, but then decreases, as I increase the radius. I would have thought that the number of tweets would increase and eventually converge to the maximum as I increase the radius.

Here is the code I'm using to test this:

iter <- seq(from=500, to=3000, by=500)
num.tweets <- numeric()
count <- 1
for (i in iter) {
  my.geo <- paste('37.7,-122,', i, 'mi', sep="")
  my.tweets.geo <- searchTwitter("coke", n=1000, lang="en", geocode = my.geo)
  num.tweets <- c(num.tweets, length(my.tweets.geo))
  print("NEW RADIUS")
  print(paste("radius:",i))
  print(paste("number of tweets:", num.tweets[count]))
  count <- count + 1
}

And here is the corresponding output:

[1] "NEW RADIUS"
[1] "radius: 500"
[1] "number of tweets: 153"
[1] "NEW RADIUS"
[1] "radius: 1000"
[1] "number of tweets: 161"
[1] "NEW RADIUS"
[1] "radius: 1500"
[1] "number of tweets: 139"
[1] "NEW RADIUS"
[1] "radius: 2000"
[1] "number of tweets: 471"
[1] "NEW RADIUS"
[1] "radius: 2500"
[1] "number of tweets: 674"
[1] "NEW RADIUS"
[1] "radius: 3000"
[1] "number of tweets: 139"

As you can see, in this particular case, the number of tweets decreases as the radius increases from 2500 to 3000. The threshold at which the number of tweets decreases changes as one change for different latitude/longitude settings, and different search queries.

Upvotes: 1

Views: 101

Answers (1)

cory
cory

Reputation: 6669

The twitter API is messed up as far as geocoded tweets is concerned. It's a known issue.

Here's a write up of my project and it's affect on it: http://www.smartchicagocollaborative.org/foodborne-chicago-affected-by-twitter-geocoding-issue/

And here's a thread with a twitter engineer discussing it... https://twittercommunity.com/t/search-api-returning-very-sparse-geocode-results/27998/10

I don't think your issue is caused by R or the twitteR package

Upvotes: 1

Related Questions