Skip to content

Commit eea7270

Browse files
authored
Merge pull request #22 from kuriwaki/cumulative2024
Cumulative 2024 link update
2 parents 661e997 + b96816d commit eea7270

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: ccesMRPprep
22
Type: Package
33
Title: Functions and Data to Prepare CCES data for MRP
4-
Version: 0.1.13
4+
Version: 0.1.14
55
Authors@R:
66
c(person(given = "Shiro",
77
family = "Kuriwaki",

R/get_dataverse.R

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#' Download a specific CCES dataset from dataverse, with some indexing
22
#'
3-
#' Get the data from dataverse into the current R environment. You must use
4-
#' the development version of [IQSS/dataverse-client-r](https://github.com/IQSS/dataverse-client-r).
5-
#' The function also does
3+
#' Wrapper function to get CCES/CES data from dataverse into the current R environment using the `dataverse` package.
64
#'
75
#'
8-
#' @param name The name of the dataset as defined in \code{data(cces_dv_ids)}.
6+
#' @param name The name of the dataset as defined in \code{data(cces_dv_ids)}. e.g. `"cumulative"` or `"2018"`.
97
#' @param year_subset The year (or years, a vector) to subset too. If `name` is a year
108
#' specific dataset, this argument is redundant, but if `name == "cumulative"`, then
119
#' the output will be the cumulative dataset subsetted to that year. This is useful
@@ -19,12 +17,19 @@
1917
#' CCES dataset. Built-in data \link{cces_dv_ids} is used as a default and should
2018
#' not be changed.
2119
#'
22-
#' @details The current dataverse package downloads the raw data, so this function writes
23-
#' the raw binary into a tempfile and loads it into a tibble with the appropriate
24-
#' file data type. We find it convenient to loop over this function for all values in
25-
#' \link{cces_dv_ids} and populate the MRP directory with all datasets (about 2GB
26-
#' in total). Each dataset has slightly different formats; using \link{get_cces_question}
27-
#' will standardize, for example, the name of the case ID.
20+
#' @details This function is a simple wrapper around the `dataverse` pacakge on CRAN.
21+
#' It downloads the dataset from the dataverse, and loads it into a tibble with the appropriate
22+
#' file data type. Using \link{get_cces_question} does some standardization across years, for example,
23+
#' the name of the case ID variable, so that it makes downstream.
24+
#' As of v0.3.15, `dataverse` accepts a cache by default if you specify a dataverse version.
25+
#' `get_cces_dataverse` does not specify a version and simplify re-downloads whatever
26+
#' is the latest version of the dataset on dataverse at the time, it does not support caching.
27+
28+
#' You may be interested in customizing your download following <https://cran.r-project.org/web/packages/dataverse/vignettes/C-download.html>,
29+
#' or downloading the feather version of the CCES cumulative, which reads much
30+
#' faster than the default .dta file in this function.
31+
#'
32+
#'
2833
#'
2934
#' @importFrom glue glue
3035
#' @importFrom stringr str_extract
@@ -36,6 +41,8 @@
3641
#' @importFrom rlang sym `!!` .data
3742
#' @importFrom dataverse get_file get_dataframe_by_name
3843
#'
44+
#' @seealso [ccc_std_demographics()] [cces_dv_ids]
45+
#'
3946
#' @examples
4047
#'
4148
#' # read in cumulative common content, subsetted to 2018, into environemt

data-raw/create_dataverse-ids.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library(tibble)
22

33
cces_dv_ids <- tribble(
44
~cces_name, ~year, ~doi, ~filename, ~caseid_var, ~server,
5-
"cumulative", NA, "10.7910/DVN/II2DB6", "cumulative_2006-2023.dta", "case_id", "dataverse.harvard.edu",
5+
"cumulative", NA, "10.7910/DVN/II2DB6", "cumulative_2006-2024.dta", "case_id", "dataverse.harvard.edu",
66
"2006", 2006, "10.7910/DVN/Q8HC9N", "cces_2006_common.tab", "v1000", "dataverse.harvard.edu",
77
"2007", 2007, "10.7910/DVN/OOXTJ5", "CCES07_OUTPUT.sav", "caseid", "dataverse.harvard.edu",
88
"2008", 2008, "10.7910/DVN/YUYIVB", "cces_2008_common.tab", "V100", "dataverse.harvard.edu",

man/get_cces_dataverse.Rd

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)