[R] TwitteR - Number of tweets from multiple locations
K. Elo
maillists at pp.inet.fi
Wed Jun 1 19:43:50 CEST 2016
Hi Juho!
01.06.2016, 14:40, Juho Kiuru wrote:
> Hi all, I am new to R and TwitteR and would love to get some advice from
> you.
>
> I managed to get list of tweets containing word 'innovation' tweeted in
> Helsinki with following script:
>
> searchTwitter('innovation', n=10000, geocode='60.1920,24.9458,30mi',
> since="2016-01-01", until="2016-05-31")
>
> However, I was wondering is it possible to involve multiple locations to
> script, so that the result would be number of tweets in each location.
>
> For example, something like this:
> Location Tweets
> Helsinki 300
> Berlin 400
> Barcelona 500
Have your read the documentation ('?searchTwitter'). The argument
'geocode' cannot be a list, only a single value.
A possible workaround could be to filter tweets based on geocode after
you have received these. However, since your search pharse is rather ge
general, you would receive a lot of "noise" as well.
One possibility would be to write a loop with three 'searchTwitter'
calls with different geocodes. Here you could speed up the data
collection by setting 'n' to e.g. 100 or 500.
You should, however, consider the fact that geocodes are often supressed
by the user, so that you would most certainly get only a limited amount
of tweets.
> Another problem I faced is in setting the time span I would like to have
> the count of tweets from. I tried to set the time span from the beginning
> of this year to end of May, but it seems like I get only tweets from the
> last week of May.
If I remember correctly this is not related to twitteR, but to the
Twitter API itself. The API limits your search results to contain tweets
from the last 7 days only.
HTH,
Kimmo
--
Kimmo Elo
Åbo Akademi University, Finland / German studies
University of Turku, Finland / DIGIN - Digital Humanities Network
More information about the R-help
mailing list