google_mobility_data: Google mobility dataset

View source: R/google_mobility.R

google_mobility_dataR Documentation

Google mobility dataset

Description

From the Google website: These Community Mobility Reports aim to provide insights into what has changed in response to policies aimed at combating COVID-19. The reports chart movement trends over time by geography, across different categories of places such as retail and recreation, groceries and pharmacies, parks, transit stations, workplaces, and residential.

Usage

google_mobility_data(accept_terms = TRUE, nrows = Inf)

Arguments

accept_terms

default is TRUE, but please make sure that you and any downstream users are aware that they are accepting Google's terms of service. See the note below.

nrows

default is Inf, but specify a smaller number to limit memory usage. This dataset is HUGE.

Details

From Google:

What’s a Community Mobility Report?

Each Community Mobility Report is broken down by location and displays the percent change from baseline in visits to places like grocery stores and parks.

Value

a data.frame

Privacy

Google provides this explanation with regard to preserving privacy:

The Community Mobility Reports were developed to be helpful while adhering to our stringent privacy protocols and protecting people’s privacy. No personally identifiable information, such as an individual’s location, contacts or movement, will be made available at any point.

Insights in these reports are created with aggregated, anonymized sets of data from users who have turned on the Location History setting, which is off by default. People who have Location History turned on can choose to turn it off at any time from their Google Account and can always delete Location History data directly from their Timeline.

We also use the same world-class anonymization technology used in our products every day to keep your activity data private and secure. This includes differential privacy, which adds artificial noise to our datasets, enabling us to generate insights while preventing the identification of any individual person.

Note

Using this function implies that you agree to the Google terms of service: https://policies.google.com/terms

Author(s)

Sean Davis seandavi@gmail.com

Source

See Also

Other data-import: acaps_government_measures_data(), acaps_secondary_impact_data(), apple_mobility_data(), beoutbreakprepared_data(), cci_us_vaccine_data(), cdc_aggregated_projections(), cdc_excess_deaths(), cdc_social_vulnerability_index(), coronadatascraper_data(), coronanet_government_response_data(), cov_glue_lineage_data(), cov_glue_newick_data(), cov_glue_snp_lineage(), covidtracker_data(), descartes_mobility_data(), ecdc_data(), econ_tracker_consumer_spending, econ_tracker_employment, econ_tracker_unemp_data, economist_excess_deaths(), financial_times_excess_deaths(), government_policy_timeline(), jhu_data(), jhu_us_data(), kff_icu_beds(), nytimes_county_data(), oecd_unemployment_data(), owid_data(), param_estimates_published(), test_and_trace_data(), us_county_geo_details(), us_county_health_rankings(), us_healthcare_capacity(), us_hospital_details(), us_state_distancing_policy(), usa_facts_data(), who_cases()

Other mobility: apple_mobility_data(), descartes_mobility_data()

Examples


# requires significant memory to run

## Not run: 
res = google_mobility_data(nrows=1000000)
colnames(res)
head(res)
dplyr::glimpse(res)

# analyze the "admin levels" available for each
# country:

admin_by_country = res %>%
    dplyr::group_by(iso2c) %>%
    dplyr::filter(date == max(date))
admin_by_country = table(admin_by_country$admin_level, 
                         admin_by_country$iso2c)/length(unique(res$places_category))
admin_by_country

# Italy mobility over time
# Note day-of week effect in plot

library(ggplot2)

res %>%
## Italy, whole country(admin == 0)
    dplyr::filter(iso2c == "IT" & admin_level==0) %>%
    ggplot(aes(x=date,y=percent_change_from_baseline,color = places_category)) +
    geom_line() +
    ggtitle('Google mobility metric for Italy') +
    theme(legend.position='bottom')

## End(Not run)


seandavi/sars2pack documentation built on May 13, 2022, 3:41 p.m.