Google knows

Just a small part of Google data-harvesting practices

Following the post by http://seasci.wordpress.com/2013/12/20/it-knows-where-i-live. I was amaze to know how much Google knows about me.

Just download the locations from Google Takeout and follow the code.

Once you have the location file

# Load in the raw data from the JSON file
require(jsonlite)
require(plyr)
require(lubridate)

raw = fromJSON("data\\location\\HistorialdeUbicaciones.json")
# Get the 'locations' part of the list
locs = raw$locations
# these are all the columns that it contains...
names(locs)
# they're in various formats...
lapply(locs, class)

Simple procesing

# Get columns into useful formats
ldf = data.frame(t = rep(0, nrow(locs)))
# time is in POSIX * 1000 (milliseconds) format, convert it to useful
# scale...
ldf$t = as.numeric(locs$timestampMs)/1000
class(ldf$t) = "POSIXct"
# lat/lon are xE7, convert them to usable numbers...
ldf$lat = as.numeric(locs$latitudeE7/1e+07)
ldf$lon = as.numeric(locs$longitudeE7/1e+07)

# And plot it...
require(ggplot2)
require(ggmap)
DC = get_map(c(-77.05, 38.93), 12, source = "google", color = "bw")

Making the map

# Let's just look at...

ggmap(DC) %+% ldf + aes(x = lon, y = lat) + stat_binhex(data = ldf, aes(x = lon, 
    y = lat), size = 5, binwidth = c(0.01, 0.01), alpha = 2/4) + scale_fill_gradient(low = "green", 
    high = "red") + scale_alpha(range = c(0, 0.25), guide = FALSE) + theme(legend.position = "none", 
    axis.title = element_blank(), text = element_text(size = 12)) + geom_point(data = ldf, 
    aes(x = lon, y = lat), colour = "blue")

The result

type: sub-section

Were I have been

## Loading required package: jsonlite
## Warning: package 'jsonlite' was built under R version 3.0.3
## Loading required package: plyr
## Warning: package 'plyr' was built under R version 3.0.3
## Loading required package: lubridate
## Warning: package 'lubridate' was built under R version 3.0.3
## 
## Attaching package: 'lubridate'
## 
## The following object is masked from 'package:plyr':
## 
##     here
## 
## Loading required package: ggplot2
## Loading required package: ggmap
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=38.93,-77.05&zoom=12&size=%20640x640&scale=%202&maptype=terrain&sensor=false
## Google Maps API Terms of Service : http://developers.google.com/maps/terms

plot of chunk unnamed-chunk-3

It is clear: