knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Load the Data

library(tidyverse)
library(covdata)
library(ggforce)

Apple's Mobility Data

Apple has made aggregated data available on relative trends in use of its Maps data across a range of cities, regions, and countries. Data show relative volume of directions requests per country/region or city compared to a baseline volume on January 13th, 2020. Apple defines the day as midnight-to-midnight, Pacific time. Cities represent usage in greater metropolitan areas and are stably defined during this period. In many countries/regions and cities, relative volume has increased since January 13th, consistent with normal, seasonal usage of Apple Maps. Day of week effects are important to normalize as you use this data. Data that is sent from users’ devices to the Apple Maps service is associated with random, rotating identifiers so Apple does not have a profile of individual movements and searches. Apple Maps has no demographic information about its users, and so cannot make any statements about the representativeness of its usage against the overall population.

apple_mobility
vec_brks <- c(-50, 0, 50)
vec_labs <- vec_brks + 100
apple_mobility %>%
  filter(geo_type == "city", transportation_type == "driving", 
         subregion_and_city %in% c("New York City", "Paris",
                       "Istanbul", "Auckland", "Mexico City")) %>%
  mutate(over_under = score < 100, 
         score = score - 100) %>%
  ggplot(mapping = aes(x = date, y = score, 
                       group = subregion_and_city, 
                       color = over_under)) + 
  geom_hline(yintercept = 0, color = "gray40") + 
  geom_col() + 
  scale_y_continuous(breaks = vec_brks, labels = vec_labs) + 
  scale_color_manual(values = c("firebrick", "steelblue")) +
  facet_wrap(~ subregion_and_city, ncol = 1) + 
  guides(color = "none") + 
  labs(x = "Date", y = "Relative Mobility", title = "Relative Trends in Apple Maps Usage for Driving, Selected Cities", 
                              subtitle = "Data are indexed to 100 for each city's usage on January 13th 2020", 
       caption = "Data: Apple. Graph: @kjhealy") + 
  theme_minimal()


kjhealy/covdata documentation built on Feb. 4, 2023, 12:52 p.m.