Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.4%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Basic Info
- Host: GitHub
- Owner: laurenceomfoisy
- License: other
- Language: R
- Default Branch: main
- Size: 183 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Created about 1 year ago
· Last pushed 10 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ces: Canadian Election Study Data Package
The `ces` package provides easy access to Canadian Election Study (CES) datasets for analysis in R. The Canadian Election Study has been conducted during federal elections since 1965, providing valuable data for political scientists, researchers, and students studying Canadian politics and voting behavior.
## Installation
You can install the released version of ces from CRAN with:
```r
install.packages("ces")
```
And the development version from GitHub with:
```r
# install.packages("devtools")
devtools::install_github("laurenceomfoisy/ces")
```
## Features
- Easy access to CES datasets from various years (1965-2021)
- Consistent data format across years
- Simple filtering and subsetting functions
- Automatic generation of variable codebooks
- Complete preservation of variable metadata (labels, value labels)
- Metadata examination tools
- Export capabilities for sharing dataset documentation
- Official PDF codebook downloads for all datasets
## Basic Usage
```{r eval=FALSE}
library(ces)
# See available datasets
list_ces_datasets(details = TRUE)
# Download 2019 CES data
ces_2019 <- get_ces("2019")
# Create a codebook
codebook <- create_codebook(ces_2019)
head(codebook)
# Get subset of variables about voting behavior
voting_data <- get_ces_subset("2019", variables = c("vote_choice", "turnout"))
# Download the official codebook PDF
download_pdf_codebook("2019")
# Download a single dataset
download_ces_dataset("2019", path = "~/CES_data")
# Download all datasets at once
download_all_ces_datasets(path = "~/CES_data")
```
## Example Analysis
```{r eval=FALSE}
library(ces)
library(dplyr)
library(ggplot2)
# Get data
ces_data <- get_ces("2019")
# Create codebook to find variables
codebook <- create_codebook(ces_data)
# Find variables related to leader evaluations
leader_vars <- codebook %>%
filter(grepl("leader|trudeau|scheer", question, ignore.case = TRUE)) %>%
pull(variable)
# Get subset with these variables
leader_data <- get_ces_subset("2019", variables = leader_vars)
# Example plot (depending on actual variable names)
if ("leader_rating_trudeau" %in% names(leader_data) &&
"leader_rating_scheer" %in% names(leader_data)) {
# Basic comparison plot
leader_data %>%
select(leader_rating_trudeau, leader_rating_scheer) %>%
gather(key = "leader", value = "rating") %>%
ggplot(aes(x = rating, fill = leader)) +
geom_density(alpha = 0.5) +
labs(title = "Leader Rating Distributions",
x = "Rating", y = "Density") +
theme_minimal()
}
```
## Available Datasets
The package currently provides access to CES datasets from 1965 to 2021:
```{r eval=FALSE}
# List all datasets
list_ces_datasets()
# Get detailed information
list_ces_datasets(details = TRUE)
```
## Working with Codebooks
CES datasets contain many variables with complex coding. The `create_codebook()` function helps you understand these variables:
```{r eval=FALSE}
# Create and explore a codebook
ces_data <- get_ces("2019")
codebook <- create_codebook(ces_data)
# Find all variables related to voting
voting_vars <- dplyr::filter(codebook, grepl("vote|ballot", question, ignore.case = TRUE))
# Export the codebook
export_codebook(codebook, "ces_2019_codebook.csv")
```
## Acknowledgments and Disclaimers
### Data Sources
This package accesses Canadian Election Study data from multiple sources:
- **[Borealis Data repository](https://borealisdata.ca/)** - the primary institutional repository hosting most CES datasets
- **[Canadian Election Study website](https://ces-eec.arts.ubc.ca/)** - the official CES project website hosting additional datasets
We gratefully acknowledge both Borealis Data and the Canadian Election Study team for maintaining and providing access to these valuable datasets.
The package author is not affiliated with the Canadian Election Study, Borealis Data, or the University of British Columbia. Users of this package should properly cite the original Canadian Election Study data in their research publications.
### Package Development
This package was developed with assistance from Claude Sonnet 3.7, an AI assistant by Anthropic. Claude helped with structuring the package, writing documentation, and implementing the core functionality. The collaboration between the human author and AI demonstrates how these tools can be used to create helpful resources for the research community.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Citation
If you use this package in your research, please cite it:
```{r eval=FALSE}
citation("ces")
```
Additionally, please cite the original Canadian Election Study data according to their citation guidelines.
Owner
- Name: Laurence-Olivier M. Foisy
- Login: LaurenceOMFoisy
- Kind: user
- Website: laurenceoliviermfoisy.com
- Repositories: 1
- Profile: https://github.com/LaurenceOMFoisy
Étudiant en science politique à l'université Laval
GitHub Events
Total
- Watch event: 1
- Push event: 16
- Create event: 3
Last Year
- Watch event: 1
- Push event: 16
- Create event: 3
Packages
- Total packages: 1
-
Total downloads:
- cran 225 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: ces
Access to Canadian Election Study Data
- Homepage: https://github.com/laurenceomfoisy/ces
- Documentation: http://cran.r-project.org/web/packages/ces/ces.pdf
- License: MIT + file LICENSE
-
Latest release: 1.0.2
published 10 months ago
Rankings
Dependent packages count: 26.4%
Dependent repos count: 32.5%
Average: 48.6%
Downloads: 86.7%
Maintainers (1)
Last synced:
10 months ago
Dependencies
.github/workflows/rhub.yaml
actions
- r-hub/actions/checkout v1 composite
- r-hub/actions/platform-info v1 composite
- r-hub/actions/run-check v1 composite
- r-hub/actions/setup v1 composite
- r-hub/actions/setup-deps v1 composite
- r-hub/actions/setup-r v1 composite
DESCRIPTION
cran
- R >= 3.5 depends
- dplyr * imports
- haven * imports
- tibble * imports
- utils * imports
- knitr * suggests
- openxlsx * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests