Skip to content

Instantly share code, notes, and snippets.

@mribeirodantas
Last active April 5, 2020 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mribeirodantas/be2743746c2a96bde0c60c25702cac79 to your computer and use it in GitHub Desktop.
Save mribeirodantas/be2743746c2a96bde0c60c25702cac79 to your computer and use it in GitHub Desktop.
mobility %>%
filter(country == 'Brazil') %>%
select(-c('updated_at')) %>%
# Updating state names
mutate(region = case_when(region == 'State of Acre' ~ 'AC',
region == 'State of Amapá' ~'AP',
region == 'State of Espírito Santo' ~ 'ES',
region == 'State of Maranhão' ~ 'MA',
region == 'State of Mato Grosso do Sul' ~ 'MS',
region == 'State of Paraná' ~ 'PR',
region == 'State of Pará' ~ 'PA',
region == 'State of Piauí' ~ 'PI',
region == 'State of Rio Grande do Sul' ~ 'RS',
region == 'State of Rondônia' ~ 'RO',
region == 'State of Santa Catarina' ~ 'SC',
region == 'State of São Paulo' ~ 'SP',
region == 'Federal District' ~ 'DF',
region == 'State of Alagoas' ~ 'AL',
region == 'State of Amazonas' ~ 'AM',
region == 'State of Ceará' ~ 'CE',
region == 'State of Goiás' ~ 'GO',
region == 'State of Mato Grosso' ~ 'MT',
region == 'State of Minas Gerais' ~ 'MG',
region == 'State of Paraíba' ~ 'PB',
region == 'State of Pernambuco' ~ 'PE',
region == 'State of Rio Grande do Norte' ~ 'RN',
region == 'State of Rio de Janeiro' ~ 'RJ',
region == 'State of Roraima' ~ 'RR',
region == 'State of Sergipe' ~ 'SE',
region == 'State of Bahia' ~ 'BA',
region == 'State of Tocantins' ~ 'TO')) -> mobility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment