1

I want to generate stats for twitter by location, e.g. number of tweets per city by date. If I use the searchTwitter() function in the twitteR package I can add a geocode location and a since time paramater but I must also specify a search string. Is there any way I can just search for tweets by geocode location and date with no search string? What I am currently using is something like this

location <- paste0(lat,",", lon,",", radius)
searchterm <- "twitter"
date <- Sys.Date()
searchTwitter(searchterm, n=1500, geocode=location, since=as.character(date))

But I want to search for all tweets from my specified location not just ones containing the string "twitter". Is this possible? I want to see growth in twitter around smaller towns/cities around the country so each individual location specific search I would not expect to return a lot of results.

4

3 回答 3

1

The search API does not provide the level of access you want. It will only return the 'most relevant' tweets and this can be based on personalisation. In addition tweets returned could be set from within the area you specify OR the user's profile lists that geo-coded as home.

If you need an exhaustive list of tweets which match your query you should look at instead services like DataSift. These have access to all public tweets you can use their query language to request a stream of GeoFencing.

于 2013-09-30T14:16:25.987 回答
1

Make your searchterm NULL:

searchTwitter('', n=1500, geocode=location, since=as.character(date))
于 2015-06-08T19:54:08.227 回答
0

I ran into the same problem for my research. I was trying to get tweets only in certain municipalities in the Netherlands. I used another map to intersect the tweets. In first instance I only gathered the tweets that are georeferenced and in the Netherlands. Then I used a map of the municipalities of the Netherlands to intersect this SpatialPointDataFrame with the municipal borders. The results are stunning, I have a map that exactly shows all urban areas covered with points and the forests are almost clear of points. But I can only use the tweets that have a location attached to it. Took me a while to figure this out, hope it helps other people!

tweets <- dbReadTable(con,name="tweetned0302")
coords <- cbind(tweets$longitude, tweets$latitude)
spdf <- SpatialPointsDataFrame(coords, tweets, proj4string = CRS("+proj=longlat     +ellps=WGS84 +datum=WGS84 +no_defs"))
tweets_transformed <- spTransform(spdf, CRS = CRS(proj4string(region_of_interest)))
tweets_in_roi <- gIntersects(tweets_transformed, region_of_interest, byid=TRUE, prepared=TRUE)
Municipality1 <- tweets_transformed[tweets_in_roi[1,],]
于 2014-04-08T01:55:48.043 回答