Función para tabular resultados de la elección (Function to tabulate election results)
tabulate_results(data, LaTeX = F)
| data | un tibble guardado como objeto en el enviroment luego de consultar   | 
    
|---|---|
| LaTeX | parámetro para obtener código   | 
    
Tabulado con resultados agregados de la eleccion. Por defecto devuelve un tabulado de class "gt_tbl" "list". Si en 
 cambio el parametro es LaTex = TRUE devuelve codigo de LaTex con class"character" 
 (Table with aggregated election results. By default it returns a tab of class 
 "gt_tbl" "list". If instead the parameter is set to LaTex = TRUE it returns LaTex code with class "character").
REQUISITOS:
1. El formato de data debe ser long para calcular resultados. 
 Si data es wide se puede transformar con make_long 
 (long format of data is required for getting results. 
 If data is in wide format you can transform it with make_long)
2. data tiene que haber incorporando los nombres de las listas. Agreguelos con get_names
 (data must have party names. Add them with get_names).
3. data tiene que haber sido descargada con parámetro level = provincia con la función 
 get_election_data
 (data must be level = provincia when downloading it with get_election_data).
tucuman_dip_gral_2017#> # A tibble: 6 x 8 #> # Groups: codprov [1] #> category round year codprov name_prov electores listas votos #> <chr> <chr> <dbl> <chr> <chr> <dbl> <chr> <dbl> #> 1 dip gral 2017 23 TUCUMAN 1217274 0180 154930 #> 2 dip gral 2017 23 TUCUMAN 1217274 0503 46609 #> 3 dip gral 2017 23 TUCUMAN 1217274 0521 319221 #> 4 dip gral 2017 23 TUCUMAN 1217274 0548 459257 #> 5 dip gral 2017 23 TUCUMAN 1217274 blancos 5920 #> 6 dip gral 2017 23 TUCUMAN 1217274 nulos 12947#> \captionsetup[table]{labelformat=empty,skip=1pt} #> \begin{longtable}{lr} #> \caption*{ #> \large TUCUMAN - 2017\\ #> \small Elección General - Diputado Nacional\\ #> } \\ #> \toprule #> Lista & Votos \\ #> \midrule #> 0548-FRENTE JUSTICIALISTA POR TUCUMAN & $46.0\%$ \\ #> 0521-CAMBIEMOS PARA EL BICENTENARIO & $32.0\%$ \\ #> 0180-FUERZA REPUBLICANA & $15.5\%$ \\ #> 0503-FRENTE DE IZQUIERDA Y DE LOS TRABAJADORES & $4.7\%$ \\ #> nulos & $1.3\%$ \\ #> blancos & $0.6\%$ \\ #> \bottomrule #> \end{longtable} #> \begin{minipage}{\linewidth} #> \textbf{Fuente:} polAr - Política Argentina usando R - \emph{https://electorarg.github.io/polAr}\\ #> \end{minipage}