knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

opuy

Nicolás Schmidt, Daniela Vairo, Martín Opertti, UMAD1.

CRAN status R-CMD-check Project Status: Active – The project has reached a stable, usable
state and is being actively
developed. r badger::badge_devel("Nicolas-Schmidt/opuy", "blue") License: MIT DOI

Uruguayan Public Opinion Data From 1989 to the Present.

Description

OPUY provides a set of Uruguay's public opinion data since 1989. The data features two relevant indicators for the study of the Uruguay's political behavior: vote intention and presidential approval.

The package manual can be found here.

Install

remotes::install_github("Nicolas-Schmidt/opuy")

Package Features

Functions

| Name |Description | | ----------------- | -------------------------------------------------------------- | |resumen_opuy|A summary of the indicators the dataset contains by year. This function has it's own print() and summary() methods.|

Data

| Name |Description | | ----------------- | -------------------------------------------------------------- | |opuy|Datset that contains two public opinion indicators: vote intention and presidential approval. Data available ranges from 1989 to the present. Data was collected from polling organizations records and news articles by Unidad de Métodos y Acceso a Datos. All data is at the aggregate level, as no individual-level data is available.|

Example

## Dataset: 'opuy'

library(opuy)

summary(resumen_opuy())

resumen_opuy(polling.org = c("Equipos", "Cifra", "Factum", "Opcion"))

Presidential Approval in Uruguay

library(extrafont)
library(tidyverse)
library(hrbrthemes)

data(opuy)

dias_sumar <- Sys.Date() - as.Date("2020-03-01")

annotation <- tibble(x = as.Date(c("1992-01-01","1997-06-06", "2002-06-06", "2007-06-06",
                                   "2012-06-06", "2017-06-06", "2022-01-01")),
                     y = 85,
                     label = c("Lacalle","Sanguinetti II", "Batlle", "Vázquez I",
                               "Mujica", "Vázquez II", "Lacalle Pou"),
                     comienzo = as.Date(c("1990-03-01", "1995-03-01", "2000-03-01", "2005-03-01",
                                          "2010-03-01", "2015-03-01", "2020-03-01"))) %>%
    mutate(ahora = comienzo + dias_sumar)

fechas <- as.Date(c("1995-03-01","2000-03-01", "200-03-01", "2010-03-01", "2015-03-01", "2020-03-01"))

colores <- c("#99ccff", "#BA0200", "#BA0200", "#013197", "#013197", "#013197", "#99ccff")

opuy %>%
    filter(medicion == 'Evaluacion de gestion presidente',
           categoria_unificada == 3) %>%
    select(fecha, empresa, valor, presidente) %>%
    mutate(presidente = factor(presidente, levels = c("Lacalle", "Sanguinetti 2",
                                                      "Batlle", "Vazquez 1", "Mujica",
                                                      "Vazquez 2", "Lacalle Pou"))) %>%
    ggplot(aes(x = fecha, y = valor, color = presidente)) +
    geom_smooth(aes(group = presidente), method="loess", se=FALSE) +
    geom_point(size = 2, alpha=0.3) +
    geom_vline(xintercept = as.numeric(fechas), linetype="dashed", size=0.3, color="grey30") +
    theme_minimal() +
    theme(legend.position = "none") +
    labs(y = "Porcentaje de aprobación",
         x = "",
         title = "Aprobación del presidente (serie histórica)",
         caption = 'Fuente: opuy (Schmidt et al. 2022)'
         ) +
    geom_text(data=annotation, aes( x=x, y=y, label=label),
              color="black", size=4) +
    scale_fill_manual(name = "", values = colores) +
    scale_color_manual(name = "", values = colores) +
    scale_x_date(date_breaks = "2 years", date_minor_breaks = "1 year",
                 date_labels = "%Y", limits = c(as.Date("1990-01-01"), NA)) +
    annotate("rect",
             xmin = annotation$comienzo,
             xmax = annotation$ahora,
             ymin = 0,
             ymax = Inf, alpha = .1)

Combined use of opuy package with Boreluy (R package with electoral data from Uruguay)

The graphic palette presented contains data from four polling organizations on voting intentions for the October 2019 national election. The line and the red dot indicate the result that each party obtained in the election. The horizontal red band is made up of the points of the last vote intention measurement of each polling organization and the result of the election. The red number at the top left of each graph indicates the distance between the last estimate and the result of the election.

source("data-raw/test.R")
manual <- function(){
    old <- here::here()
    path <- here::here('man', 'figures')
    sink('noise.txt')
    devtools::build_manual(path = path)
    sink()
    setwd(path)
    invisible(file.rename(list.files(pattern="^opuy"), 'Manual_opuy.pdf'))
    setwd(old)
    invisible(file.remove('noise.txt'))
}
manual()

:bookmark_tabs: Citation

Pleas cite the use of data or opuy package. Use the following citation:

Schmidt, Nicolás, Vairo, Daniela, Opertti, Martín , UMAD (2022) opuy: Datos de Opinión Pública de Uruguay 1989 a la actualidad, R package version 0.1.1001, https://nicolas-schmidt.github.io/opuy/.


Maintainer

Nicolás Schmidt (nschmidt@cienciassociales.edu.uy)

Notes


1 Unidad de Métodos y Acceso a Datos, Facultad de Ciencias Sociales, Universidad de la República (UMAD-FCS-UdelaR)



Nicolas-Schmidt/opuy documentation built on July 28, 2023, 3:57 a.m.