View source: R/download_apple_mtr_data.R
download_apple_mtr_data | R Documentation |
Provides Mobility Trends Reports related to Covid-19 as provided by Apple
(https://www.apple.com/covid19/mobility). Since apple is no longer
providing this data since April 14, 2022 the cached data will be returned
and calling the function with cache = FALSE
will yield an error.
download_apple_mtr_data(
type = "country",
url = NULL,
silent = FALSE,
cached = TRUE
)
type |
The type of data that you want to retrieve. Can be any subset of
|
url |
The URL of the now defunct Apple Mobility Trend Reports. Ignored. |
silent |
Whether you want the function to send some status messages to
the console. Might be informative as downloading will take some time
and thus defaults to |
cached |
Whether you want to download the cached version of the data
from the tidycovid19 Github repository. As Apple is no longer provides
the data, this needs to be set to |
A data frame containing the data. It includes a timestamp
variable indicating the time of data retrieval.
df <- download_apple_mtr_data(silent = TRUE, cached = TRUE)
df %>%
dplyr::group_by(date) %>%
dplyr::summarize(
walking = mean(walking, na.rm = TRUE)
) %>%
ggplot2::ggplot(ggplot2::aes(x = date, y = walking)) +
ggplot2::geom_line()
df <- download_apple_mtr_data(type = "country_city", silent = TRUE, cached = TRUE)
df %>%
dplyr::filter(iso3c == "DEU") %>%
ggplot2::ggplot(ggplot2::aes(x = date, y = driving, color = city)) +
ggplot2::geom_line()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.