View source: R/compute_competitiveness.R
| compute_competitiveness | R Documentation | 
Funcion que describe el grado de competencia de una eleccion (Function that describes the degree of competition of an election)
compute_competitiveness(data, level = "provincia")
| data | un tibble guardado como objeto en el Enviroment luego de consultar  | 
| level | un character que establece el nivel de agregacion sobre el que se quiere calcular la competitividad: 
por defualt es  | 
Competitividad mide la diferencia porcentual de votos válidos obtenidos por los dos partidos más votados a y b. 
Puede tomar valores entre [0,1] donde 1 es lo más comeptitivo (a = 50\% y b = 50\% de los votos).
La fórmula utilizada es:  
Competitividad = 1 - (a - b)
REQUISITO:
El formato de data debe ser long para calcular compute_competitiveness. 
Si data es wide se puede transformar con make_long 
(long format of data is required for compute_competitiveness. If data is in wide format
you can transform it with make_long).
devuelve un tibble con class "tbl_df","tbl", "data.frame" con el computo de competitividad de una elccion. El resultado puede 
ser un valor entre 0 y 1, 
los cuales representan falta de competencia y competitivdad maxima, respectivamente 
(returns a tibble with class "tbl_df", "tbl", "data.frame" with the computation of the level of competitiveness of an elction. 
The result can be a value between 0 and 1, which represent a lack of competition and maximum competitiveness, respectively).
compute_nep, compute_seats, compute_disproportion
   tucuman_dip_gral_2017
   tucuman_dip_gral_2017 %>% 
     compute_competitiveness()
     
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.