Data"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

 options(rmarkdown.html_vignette.check_title = FALSE)

EXPLORAR DATOS (Data explorer)

OBTENER DATOS (Get data)

Elections

Entre los primeros se deben consignar district para el distrito; category para la catgoría; round para el turno e year para el año de la elección. Entre los segundos se puede agregar levelpara el nivel de agregación -"provincia", "departamento", "circuito"- y long para el formato de los datos alargados donde las listas no van cada una en una columna sino como valores de una variable listas (Among the first, district; category;round andyear must be consigned. Between the seconds you can add level for the level of aggregation -"provincia","departmento","circuito"- andlong for long formatted data where party lists do not go in columns but as values of a lists variable).

Text

Geo


EJEMPLOS (Examples)

library(polAr)

ELECTORAL

Explorar datos disponibles con show_available_elections() (Explore Data)

La función show_available_elections() muestra las elecciones disponibles para descarga. Por defecto el parámetro viewer = FALSE imprime el resultado en consola. Si en cambio escribimos viewer = TRUE los datos se presentan en el Viewer de RStudio y quedan a mano como tabla formateada y con la capacidad de ordenar y filtrar valores.

(show_available_elections () function displays available electoral data for download. By default the parameter viewer = FALSE prints the result in console. If instead we write viewer = TRUE data is presented in the RStudio Viewer as a handy formatted table and with the ability to sort and filter values).

library(polAr)

show_available_elections()

Obtener datos con get_election_data() (Get data)

get_election_data() es la función principal para hacernos de los datos disponibles. Los parámetros obligatorios son los que definen el distrito (district), la categoría (category), el turno (round) y el año electoral (year)

(get_election_data() is the main function to get the available data. The mandatory parameters are those that define the district (district), the category (category), the turn (round) and the electoral year (year)).

Por defecto los datos colapsan a nivel provincial, pero podemos definir otros niveles como departamento o circuito electoral con el parámetro levels

(By default the data collapses at the provincial level, but we can define other levels such as department or electoral circuit with the parameter levels).

Abajo el resultado de la consulta solo con los parámetros obligatorios, en el primer caso, y con un nivel de desagregación menor en el segundo (Below is the result of the query only with the mandatory parameters, in the first case, and with a lower level of disaggregation in the second):

get_election_data(district = "caba", 
                  category = "dip",
                  round = "paso", 
                  year = 2011,
                  long = FALSE)

Transformar estructura de datos anchos (wide) a largos (long) con make_long() (Transform data from wide to long).

Por defecto los datos se descargan en formato long. Pero si hubieramos descargado resultados en formato wide como en el ejemplo anterior, existe la posibilidad de transformarlos y cambiar a long usando la función auxiliar make_long()

(By default the data is downloaded in long format. But if we had downloaded results in wide format as in the previous example, there is the possibility to transform them and change to long using the auxiliary function make_long()).

Este sería el caso haciendo una llamada similar a la del ejemplo anterior pero ahora a nivel departamentoy guardandola en un objeto con nombre data (This would be the case by making a call similar to the previous example but now at the department level and saving it in an object with the name data.):

data <- get_election_data(district = "caba", 
                          category = "dip",
                          round = "paso", 
                          year = 2011, 
                          level = "departamento", long = FALSE) %>% 
  print()

Usamos la función auxiliar para convertir el formato de data (We use the helper function to convert the format of data):

data %>% 
  make_long() 

Obtener nombres de listas o partidos políticos con get_names() (Get parties names)

Siguiendo el ejemplo anterior, una vez que data cambió a formato long se puede incorporar facilmente el nombre de los partios correspondientes al id de la columna listas con get_names()

(Following the example above, once data has changed to long format, you can easily enter the names of the partitions corresponding to the id of the lists column with get_names()):

data %>% 
  make_long %>% 
  get_names() 

FUENTES (Sources)

(Trabajo en proceso - Work in progress)

Electorales (Electoral)

Discursos (Speeches)

Con el aporte de Lucas Enrich y Camila Higa trabajamos sobre una base de datos de discursos de apertura de sesiones legislativas de los presidentes argentinos: desde el primer discurso de Justo José de Urquiza en 1854 hasta el de Alberto Fernández en 2020. Se disponibilizan versiones de texto con mínimo procesamiento y otras en formato tidy, siguiendo la definición de Julia Silge y David Robinson (With the contribution of Lucas Enrich and Camila Higat we worked on a database of speeches for the opening of legislative sessions of Argentine presidents: from the first speech by Justo José de Urquiza in 1854 to that of Alberto Fernández in 2020. Text versions are available with minimal processing and others in format tidy, following the definition of Julia Silge and David Robinson).



Try the polAr package in your browser

Any scripts or data that you put into this service are public.

polAr documentation built on Feb. 22, 2021, 5:07 p.m.