This is just a quick document which plots geolocations
Extracting geolocations from json files were unexpectedly troublesome. I spent multiple hours to figure out a way to do that. In the end, i managed to extract geolocations in the specified timespan but I cannot match them with tweet texts or dates.
I’ve selected the subset we have identified before, the two weeks in August 2016, when we observed a peak in slur matches in the data.
## Parsed with column specification:
## cols(
## lat = col_double(),
## long = col_double()
## )
## [1] 109
There were only 109 geolocated tweets in the selected timeframe (109 out of 103K tweets). First I’ll map them as they are.
world <- ggplot() +
# theme_map() +
borders("world", colour = "gray85", fill = "gray80") +
coord_map( xlim=c(-180,180), ylim=c(-55,85))
world + geom_point(aes(x = long, y = lat),
data = cst,
colour = 'purple', alpha = 1, size=1)
As can be seen, majority of geolacated tweets are from the UK. There are nearly 15 of 109 geolocated tweets outside the UK.
UK <- ggplot() +
# theme_map() +
borders("world", region= 'UK', colour = "gray85", fill = "gray80") +
coord_map( xlim=c(-11,3), ylim=c(49,60))
geolocated <- UK +
geom_point(aes(x = long, y = lat),
data = cst,
colour = 'purple', alpha = .5, size=2)
# UK
# geolocated
labelled <- geolocated+
labs( x= 'Longitude', y= "Latitude",
title = "Geolocated Tweets across the UK",
subtitle = "Timespan: 24 July 2016 - 08 August 2016",
caption = "Social Data Lab") +
theme_ipsum_rc()
labelled
This is a quite diverse graph but the high frequency in London should also be noted.
london <- get_map("kensington,uk", zoom=11)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=kensington,uk&zoom=11&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=kensington,uk&sensor=false
q <- ggmap(london)
q + geom_point(data = cst, aes(x=long,y=lat), color="purple",size=2, alpha=0.5 )
Looks like even in London, geolocations are not distributed around London much.