cislongitudinal lets you download, cache, update, inspect, and query the longitudinal CIS dataset published by Spain Electoral Project as a Parquet file. The package keeps the data outside your project directory and uses Arrow so filters and column selection can run before data is collected into memory.
Download the dataset
The local file is stored in:
By default this is the application data directory returned by:
rappdirs::user_data_dir("cislongitudinal", "spainelectoralproject")Check the local copy
cis_available()
cis_path()
cis_info()
cis_manifest()Update
cis_update() reads the remote manifest and replaces the local Parquet only after a successful download and validation.
Read data
Filter by date:
df <- cis_read(fecha_min = "2023-01-01")Filter by date range:
df <- cis_read(
fecha_min = "2020-01-01",
fecha_max = "2024-12-31"
)Filter by study code:
Select columns:
df <- cis_read(
fecha_min = "2023-01-01",
cols = c("estudio", "fecha", "genero", "edad", "idv", "recuerdo")
)When keep_core_cols = TRUE, cis_read() always keeps the core columns: estudio, fecha, genero, and edad.
Lazy queries
Use collect = FALSE to keep working lazily:
df_lazy <- cis_read(
fecha_min = "2020-01-01",
collect = FALSE
)
df_lazy |>
dplyr::count(estudio) |>
dplyr::collect()For advanced queries, open the local dataset directly:
Explore columns and studies
cis_cols()
cis_schema()
cis_studies()