# opencis Search and import data directly to R from the Spanish Sociological Research Center (CIS). The CIS is a public institution that conducts electoral and sociological research studies on the Spanish society. The CIS has a large database of surveys that can be accessed through its website. The package includes functions to search for surveys, survey questions and timeseries, and import the data directly to R. ## Installation You can install the released version of `opencis` from CRAN: ``` r install.packages("opencis") ``` You can install the development version from GitHub using the `remotes` package: ``` r remotes::install_github("hmeleiro/opencis") ``` ## Usage The package includes two functions. The first function is used to search for surveys, survey questions and data series ``` r # Search for survey studies library(opencis) # Search for survey studies search_cis(q = "preelectoral", from = "2020-01-01", to = "2023-11-17") #> # A tibble: 27 × 4 #> study date title url #> #> 1 3411 2023-06-08 Preelectoral elecciones generales 2023 http… #> 2 3402 2023-04-10 Preelectoral elecciones municipales y autonómicas 2023 http… #> 3 3306 2021-01-02 Preelectoral de Cataluña. Elecciones autonómicas 2021 http… #> 4 3317 2021-03-19 Preelectoral elecciones autonómicas 2021. Comunidad de Madrid http… #> 5 3287 2020-06-10 Preelectoral de Galicia. Elecciones autonómicas julio 2020 http… #> 6 3276 2020-02-17 Preelectoral de Galicia. Elecciones autonómicas abril 2020 http… #> 7 3286 2020-06-10 Preelectoral del País Vasco. Elecciones autonómicas julio 2020 http… #> 8 3275 2020-02-17 Preelectoral del País Vasco. Elecciones autonómicas abril 2020 http… #> 9 3365 2022-05-17 Preelectoral elecciones autonómicas 2022. Comunidad autónoma de A… http… #> 10 3348 2022-01-07 Preelectoral elecciones autonómicas 2022. Comunidad autónoma de C… http… #> # ℹ 17 more rows #> # ℹ Use `print(n = ...)` to see more rows # Search for survey questions search_cis(q = "feminismo", catalogo = "pregunta") #> # A tibble: 8 × 4 #> question date title url #> #> 1 Pregunta 3428/0/0016 2023-11-06 Escala de autodefinición feminista (0-10) http… #> 2 Pregunta 2212/0/0008 1996-04-13 Sentimientos hacia diferentes ideologías, situaciones… http… #> 3 Pregunta 2828/0/0010 2010-01-09 Rasgos ideológicos que definen a la derecha y a la iz… http… #> 4 Pregunta 1993/0/0009 1992-02-27 Sentimientos hacia diferentes ideologías, situaciones… http… #> 5 Pregunta 2401/0/0025 2000-12-09 Rasgos ideológicos que definen a la derecha y a la iz… http… #> 6 Pregunta 3428/0/0010 2023-11-06 Aprobación de diferentes conductas pro-igualdad de gé… http… #> 7 Pregunta 2016/0/0026 1992-07-09 Rasgos que definen a la derecha y a la izquierda polí… http… #> 8 Pregunta 2154/0/0036 1995-04-03 Rasgos que definen a la derecha y a la izquierda polí… http… # Search for data series search_cis(q = "situación económica", catalogo = "serie") #> # A tibble: 100 × 5 #> serie from to title url #> #> 1 Serie K.1.03.03.012 2011-11-21 2025-09-12 Situación económica familiar (ICC) https:… #> 2 Serie K.1.02.01.014 1992-11-13 2019-10-01 Valoración de la situación económica actual de España (Extremadura) https:… #> 3 Serie K.1.02.01.008 1992-11-14 2019-06-17 Valoración de la situación económica actual de España (Cantabria) https:… #> 4 Serie K.1.02.01.003 1986-05-01 2019-10-01 Valoración de la situación económica actual de España (Andalucía) https:… #> 5 Serie K.1.02.01.004 1998-05-01 2019-10-01 Valoración de la situación económica actual de España (Aragón) https:… #> 6 Serie K.1.02.01.007 1998-05-01 2019-10-01 Valoración de la situación económica actual de España (Canarias) https:… #> 7 Serie K.1.02.01.019 1998-05-01 2015-05-29 Valoración de la situación económica actual de España (La Rioja) https:… #> 8 Serie K.1.02.01.011 1992-11-07 2020-03-01 Valoración de la situación económica actual de España (Cataluña) https:… #> 9 Serie K.1.03.01.012 2010-01-23 2017-09-21 Valoración de la situación económica personal actual (Andalucía) https:… #> 10 Serie K.1.03.01.020 1992-04-24 2025-10-01 Valoración de la situación económica personal actual (Nacional) https:… #> # ℹ 90 more rows #> # ℹ Use `print(n = ...)` to see more rows ``` The second function is used to import the data directly into R. ``` r # Read a survey study df <- read_cis(3411) print(df) #> # A tibble: 29,201 × 216 #> ESTUDIO REGISTRO CUES CCAA PROV MUN CAPITAL TAMUNI ENTREV TIPO_TEL SEXO #> #> 1 3411 [3411] 492777 29043 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 1 [Men… 0 [Ano… 2 [Móvi… 1 [Hom… #> 2 3411 [3411] 70655 5848 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 1 [Men… 0 [Ano… 2 [Móvi… 2 [Muj… #> 3 3411 [3411] 46423 3893 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> 4 3411 [3411] 103464 8711 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> 5 3411 [3411] 112810 9517 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> 6 3411 [3411] 126567 10736 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 1 [Hom… #> 7 3411 [3411] 137692 11573 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> 8 3411 [3411] 182178 14839 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> 9 3411 [3411] 216764 16793 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 1 [Fijo] 2 [Muj… #> 10 3411 [3411] 237655 17918 1 [And… 4 [Alm… 0 [Mun… 3 [Otr… 3 [10.… 0 [Ano… 2 [Móvi… 2 [Muj… #> # ℹ 29,191 more rows #> # ℹ 205 more variables: EDAD , P0A , ECOPER , ECOESP , #> # MEDIO_1 , MEDIO_2 , LEEPRENSA , VETELE , #> # OYERADIO , PRENSA , P3AR , TELEVISION , #> # P3BR , RADIO , P3CR , GESTIONGOB , #> # GESTIONOPO , PROBVOTO , VOTOCORREO , PROBPARTIDOS_1 , #> # PROBPARTIDOS_2 , PROBPARTIDOS_3 , PROBPARTIDOS_4 , … #> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names ``` # Package index ## Import data Functions to import CIS study data into R. - [`read_cis()`](https://opencis.spainelectoralproject.com/reference/read_cis.md) : Import a CIS study - [`download_study()`](https://opencis.spainelectoralproject.com/reference/download_study.md) : Download a CIS study ZIP file to disk - [`get_data_dictionary()`](https://opencis.spainelectoralproject.com/reference/get_data_dictionary.md) : Extract a data dictionary from a CIS study data frame ## Search Functions to search for studies, questions and timeseries in the CIS catalog. - [`search_cis()`](https://opencis.spainelectoralproject.com/reference/search_cis.md) : Search for CIS studies. - [`search_all_cis()`](https://opencis.spainelectoralproject.com/reference/search_all_cis.md) : Search all CIS results with automatic pagination ## Study details Functions to retrieve metadata and documents for a specific study. - [`get_metadata()`](https://opencis.spainelectoralproject.com/reference/get_metadata.md) : Get metadata of a CIS study - [`browse_pdf()`](https://opencis.spainelectoralproject.com/reference/browse_pdf.md) : Open the questionnaire PDF of a CIS study ## Utilities Helper functions for cache management. - [`clear_cache()`](https://opencis.spainelectoralproject.com/reference/clear_cache.md) : Clear the opencis session cache # Articles ### All vignettes - [How to use opencis](https://opencis.spainelectoralproject.com/articles/usage.md):