|
1 | 1 | #' Download a specific CCES dataset from dataverse, with some indexing |
2 | 2 | #' |
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. |
6 | 4 | #' |
7 | 5 | #' |
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"`. |
9 | 7 | #' @param year_subset The year (or years, a vector) to subset too. If `name` is a year |
10 | 8 | #' specific dataset, this argument is redundant, but if `name == "cumulative"`, then |
11 | 9 | #' the output will be the cumulative dataset subsetted to that year. This is useful |
|
19 | 17 | #' CCES dataset. Built-in data \link{cces_dv_ids} is used as a default and should |
20 | 18 | #' not be changed. |
21 | 19 | #' |
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 | +#' |
28 | 33 | #' |
29 | 34 | #' @importFrom glue glue |
30 | 35 | #' @importFrom stringr str_extract |
|
36 | 41 | #' @importFrom rlang sym `!!` .data |
37 | 42 | #' @importFrom dataverse get_file get_dataframe_by_name |
38 | 43 | #' |
| 44 | +#' @seealso [ccc_std_demographics()] [cces_dv_ids] |
| 45 | +#' |
39 | 46 | #' @examples |
40 | 47 | #' |
41 | 48 | #' # read in cumulative common content, subsetted to 2018, into environemt |
|
0 commit comments