Skip to content

Commit

Permalink
Merge pull request #15 from kuriwaki/dev
Browse files Browse the repository at this point in the history
2006-2023 updates
  • Loading branch information
kuriwaki committed Aug 1, 2024
2 parents 66cf538 + aae5a5c commit 6052f73
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ccesMRPprep
Type: Package
Title: Functions and Data to Prepare CCES data for MRP
Version: 0.1.11.9999
Version: 0.1.12
Authors@R:
c(person(given = "Shiro",
family = "Kuriwaki",
Expand Down Expand Up @@ -33,7 +33,7 @@ Imports:
dataverse (>= 0.3.0),
tidycensus (>= 0.11.4),
furrr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Language: en-US
Roxygen: list(markdown = TRUE)
License: MIT + file LICENSE
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

# cccesMRPprep 0.1.12

* Add 2021, 2022, and 2023 to cces_dv_ids
* Add 2022 validated vote and 2023 cumulative name update to cces_dv_ids

# ccesMRPprep 0.1.11

* Add CD-level analyses
Expand Down
6 changes: 3 additions & 3 deletions R/get_dataverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#'
#'
get_cces_dataverse <- function(name = "cumulative",
year_subset = 2006:2020,
year_subset = NULL,
std_index = TRUE,
dataverse_paths = ccesMRPprep::cces_dv_ids) {

Expand All @@ -79,7 +79,7 @@ get_cces_dataverse <- function(name = "cumulative",
if (filetype == ".tab" | filetype == ".dta")
fun <- haven::read_dta

if (filetype == ".dta" & isTRUE(yr == 2009))
if (filetype == ".dta" & (yr %in% c(2009, 2022)))
fun <- function(x) haven::read_dta(x, encoding = "latin1")

if (filetype == ".sav")
Expand All @@ -96,7 +96,7 @@ get_cces_dataverse <- function(name = "cumulative",
.f = fun)

# subset ---
if (name == "cumulative") {
if (name == "cumulative" & !is.null(year_subset)) {
cces_raw <- filter(cces_raw, .data$year %in% year_subset)
}

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ output: github_document
---

<!-- badges: start -->
[![tic](https://github.com/kuriwaki/ccesMRPprep/workflows/tic/badge.svg?branch=main)](https://github.com/kuriwaki/ccesMRPprep/actions)
[![check-standard](https://github.com/kuriwaki/ccesMRPprep/actions/workflows/check-standard.yml/badge.svg)](https://github.com/kuriwaki/ccesMRPprep/actions/workflows/check-standard.yml)
<!-- badges: end -->

```{r setup, include=FALSE}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Portable Routines for Preparing CCES and ACS data for MRP

<!-- badges: start -->

[![tic](https://github.com/kuriwaki/ccesMRPprep/workflows/tic/badge.svg?branch=main)](https://github.com/kuriwaki/ccesMRPprep/actions)
[![check-standard](https://github.com/kuriwaki/ccesMRPprep/actions/workflows/check-standard.yml/badge.svg)](https://github.com/kuriwaki/ccesMRPprep/actions/workflows/check-standard.yml)
<!-- badges: end -->

Cite as:
Expand Down
5 changes: 4 additions & 1 deletion data-raw/create_dataverse-ids.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library(tibble)

cces_dv_ids <- tribble(
~cces_name, ~year, ~doi, ~filename, ~caseid_var, ~server,
"cumulative", NA, "10.7910/DVN/II2DB6", "cumulative_2006-2021.dta", "case_id", "dataverse.harvard.edu",
"cumulative", NA, "10.7910/DVN/II2DB6", "cumulative_2006-2023.dta", "case_id", "dataverse.harvard.edu",
"2006", 2006, "10.7910/DVN/Q8HC9N", "cces_2006_common.tab", "v1000", "dataverse.harvard.edu",
"2007", 2007, "10.7910/DVN/OOXTJ5", "CCES07_OUTPUT.sav", "caseid", "dataverse.harvard.edu",
"2008", 2008, "10.7910/DVN/YUYIVB", "cces_2008_common.tab", "V100", "dataverse.harvard.edu",
Expand All @@ -18,6 +18,9 @@ cces_dv_ids <- tribble(
"2018", 2018, "10.7910/DVN/ZSBZ7K", "cces18_common_vv.dta", "caseid", "dataverse.harvard.edu",
"2019", 2019, "10.7910/DVN/WOT7O8", "CCES19_Common_OUTPUT.tab", "caseid", "dataverse.harvard.edu",
"2020", 2020, "10.7910/DVN/E9N6PH", "CES20_Common_OUTPUT_vv.dta", "caseid", "dataverse.harvard.edu",
"2021", 2021, "10.7910/DVN/OPQOCU", "CES21_Common_OUTPUT.tab", "caseid", "dataverse.harvard.edu",
"2022", 2022, "10.7910/DVN/PR4L8P", "CCES22_Common_OUTPUT_vv_topost.dta", "caseid", "dataverse.harvard.edu",
"2023", 2023, "10.7910/DVN/JQJTCC", "CCES23_Common_OUTPUT.tab", "caseid", "dataverse.harvard.edu",
)


Expand Down
Binary file modified data/cces_dv_ids.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/get_cces_dataverse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6052f73

Please sign in to comment.