Created
May 4, 2020 23:51
-
-
Save thoughtfulbloke/473b482c8c83578c948006fc6cdfe964 to your computer and use it in GitHub Desktop.
Apple Mobility Data example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readr) | |
library(dplyr) | |
library(tidyr) | |
library(lubridate) | |
library(ggplot2) | |
# from the downloaded apple mobiblity data of the day | |
mobl <- read_csv("applemobilitytrends-2020-05-03.csv") | |
# colums added for each day, so get number of coluns in current data | |
extant <- ncol(mobl) | |
# graph specific choices | |
wanted_regions <- c("New Zealand", "Australia") | |
wanted_modes <- c("driving", "walking") | |
mobl %>% | |
filter(region %in% wanted_regions, transportation_type %in% wanted_modes) %>% | |
gather(key=Date, value=usage, 5:extant) %>% | |
mutate(Date = ymd(Date)) %>% | |
ggplot(aes(x=Date, y=usage, colour=region, linetype=transportation_type)) + | |
geom_line() + theme_minimal() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment