Created
August 24, 2023 10:59
-
-
Save jtrecenti/bd558414af0f46dbb710c64fca971b0d to your computer and use it in GitHub Desktop.
codigo_drogas
This file contains 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
ssp_criterios <- ssp_cortes %>% | |
mutate(corte = as.numeric(corte) / 10) %>% | |
gather(tipo_contagem, valor, maior, menor, total) %>% | |
unite(tipo_rubrica_contagem, tipo_rubrica, tipo_contagem, sep = "_") %>% | |
spread(tipo_rubrica_contagem, valor) %>% | |
mutate(soma = trafico_menor + | |
input$peso * porte_maior, | |
prop = trafico_menor / trafico_total + | |
input$peso * porte_maior / porte_total) %>% | |
group_by(droga_tipo) %>% | |
arrange(corte) %>% | |
mutate_at(vars(soma, prop), | |
funs(minimo = min(.), qualmin = corte[which.min(.)])) %>% | |
ungroup() %>% | |
mutate(prop_impunidade = trafico_menor / trafico_total, | |
prop_injustica = porte_maior / porte_total, | |
soma_impunidade = trafico_menor, | |
soma_injustica = porte_maior) | |
ssp_criterios |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment