One of the nice things about the Apple data is that it goes to the city scale. This matches up nicely with the United Nations Code for Trade and Transport Locations schema - a detailed schema that gives a great deal of information about these cities, including, for many, geospatial information. We can look at these cities, then, using some standard spatial methods.
Let’s load the data.
To turn it into something spatial, we’ll need to join it with the UN LOCODE classification, filter out missing spatial info, and then transform it, using as our Coordinate Reference System EPSG 4326.
# Get UN LOCODEs # from jebyrnes/unlocode locode_url <- "https://github.com/jebyrnes/unlocodeR/raw/master/data/unlocode.rda" f <- tempfile() utils::download.file(locode_url, f, quiet = TRUE) load(f) # loads unlocode unlink(f) #filter to only what we need unlocode <- unlocode %>% select(un_locode, latitude_dec, longitude_dec ) # JOIN! apple_cities_spatial <- apple_cities %>% left_join(unlocode, by = c("location_code" = "un_locode")) %>% #remove no spatial info filter(!is.na(latitude_dec)) %>% #turn into an sf object using x, y st_as_sf(coords = c("longitude_dec", "latitude_dec"), crs = 4326)
So, where are these cities around the globe? Let’s look!
So, given this map, let’s look at change between February 1st and April 1st, and then between April 1st and June 1st.
Let’s look at the Februrary to April change first
What about April to June?