Skip to content

Commit

Permalink
Incluir más variables a generar
Browse files Browse the repository at this point in the history
  • Loading branch information
segasi committed Oct 24, 2019
1 parent 4074e16 commit bd1336c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 02_codigo/analisis_victimas_homicidio_2015_2019.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ victimas <-
key = "mes",
value = "numero")

### Generar diversas variable relacionadas con el tiempo y reordenar columnas ----
### Generar diversas variables ----
victimas <-
victimas %>%
# Generar variables
mutate(mes_num = case_when(mes == "enero" ~ 1,
mes == "febrero" ~ 2,
mes == "marzo" ~ 3,
Expand All @@ -30,5 +31,7 @@ victimas <-
mes == "octubre" ~ 10,
mes == "noviembre" ~ 11,
mes == "diciembre" ~ 12),
fecha = make_date(ano, mes_num)) %>%
fecha = make_date(ano, mes_num),
admin = ifelse(fecha < as.Date("2018-12-01"), "Peña Nieto", "AMLO")) %>%
# Reordenar variables
select(fecha, año = ano, mes, mes_num, everything())

0 comments on commit bd1336c

Please sign in to comment.