diff --git a/DESCRIPTION b/DESCRIPTION index 3e1fb55..de57fb0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,9 +31,8 @@ Imports: lifecycle, pipfun (>= 0.3.10), glue, - qs, - pins, - stamp + stamp, + qs2 Suggests: withr, rmarkdown, diff --git a/NAMESPACE b/NAMESPACE index 849d1bf..3673ad9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(as_pipid) export(as_pipmd) export(assign_pipclass) export(aux_ids) +export(check_dlw_id_name) export(find_dlw_data) export(find_pip_data) export(get_from_piploadenv) diff --git a/R/OLD_pip_load_aux.R b/R/OLD_pip_load_aux.R index 7e7e26e..9332e7c 100644 --- a/R/OLD_pip_load_aux.R +++ b/R/OLD_pip_load_aux.R @@ -35,6 +35,7 @@ #' @export #' #' @examples +#' \dontrun{ #' # Load CPI #' cpi <- pip_load_aux("cpi") #' @@ -49,7 +50,6 @@ #' head(av) #' df <- pip_load_aux(measure, version = av[1]) #' head(df) -#' \dontrun{ #' df <- pip_load_aux(measure, version = -1) #' head(df) #' df <- pip_load_aux(measure, version = "pick") @@ -332,20 +332,13 @@ read_by_format <- function(file_to_load) { pformat <- fs::path_ext(file_to_load) x <- - if (pformat == "qs") { - - qs::qread(file_to_load) - - } else if (pformat == "fst") { - + if (pformat == "qs2") { + qs2::qs_read(file_to_load) + } else if (pformat == "fst") { fst::read_fst(file_to_load, as.data.table = TRUE) - } else if (pformat == "rds") { - readr::read_rds(file_to_load) - } else if (pformat == "dta") { - haven::read_dta(file_to_load) } @@ -366,7 +359,7 @@ read_by_format <- function(file_to_load) { find_path <- function(file_paths) { extensions <- fs::path_ext(file_paths) - ext_order <- c("qs", "fst", "rds", "dta") + ext_order <- c("qs2", "fst", "rds", "dta") f <- FALSE i <- 1 diff --git a/R/load_dlw_data.R b/R/load_dlw_data.R index f9bf46c..8b72655 100644 --- a/R/load_dlw_data.R +++ b/R/load_dlw_data.R @@ -37,7 +37,7 @@ #' verbose = FALSE) #' #' # Using id_name -#' load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs") +#' load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs2") #' #' # without ext also works #' load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG") @@ -240,7 +240,7 @@ find_dlw_data <- function( #' @param id_name id name of dlw data #' #' @returns character with id_name -#' @keywords internal +#' @export #' @rdname load_dlw_data #' #' @examples @@ -266,7 +266,9 @@ check_dlw_id_name <- \(id_name) { #' @export #' #' @examples +#' \dontrun{ #' load_dlw_gmd_inventory() +#' } load_dlw_gmd_inventory <- \() { binv <- pipfun::get_pip_folders(folder = "dlw_inventory", verbose = FALSE) @@ -289,7 +291,9 @@ load_dlw_gmd_inventory <- \() { #' @export #' #' @examples +#' \dontrun{ #' load_dlw_gmd_log() +#' } load_dlw_gmd_log <- \() { binv <- pipfun::get_pip_folders(folder = "dlw_inventory", verbose = FALSE) @@ -311,7 +315,9 @@ load_dlw_gmd_log <- \() { #' @export #' #' @examples +#' \dontrun{ #' load_gmd_valid_inv() +#' } load_gmd_valid_inv <- \() { binv <- pipfun::get_pip_folders(folder = "dlw_metadata", verbose = FALSE) @@ -333,7 +339,9 @@ load_gmd_valid_inv <- \() { #' @export #' #' @examples +#' \dontrun{ #' load_gmd_valid_log() +#' } load_gmd_valid_log <- \() { binv <- pipfun::get_pip_folders(folder = "dlw_metadata", verbose = FALSE) @@ -355,7 +363,9 @@ load_gmd_valid_log <- \() { #' @export #' #' @examples +#' \dontrun{ #' load_gmd_valid_report() +#' } load_gmd_valid_report <- \() { binv <- pipfun::get_pip_folders(folder = "dlw_metadata", verbose = FALSE) diff --git a/R/load_pip_data.R b/R/load_pip_data.R index 8d1d799..fd0edaf 100644 --- a/R/load_pip_data.R +++ b/R/load_pip_data.R @@ -43,9 +43,8 @@ #' verbose = FALSE) #' #' # Using id_name -#' load_pip_data(id_name = "LCA_2015_SLCHBS_INC_GPWG") -#' -#' } +#' load_pip_data(id_name = "BOL_2022_EH_INC_ALL") +#'} load_pip_data <- function( country_code = NULL, surveyid_year = NULL, @@ -159,10 +158,10 @@ load_pip_data <- function( #' verbose = FALSE) #' #' # Find data -#' find_pip_data(country_code = "HRV") +#' find_pip_data(country_code = "BOL") #' #' # Latest year in EACH module -#' find_pip_data(country_code = "HRV", latest_year = TRUE) +#' find_pip_data(country_code = "BOL", latest_year = TRUE) #' } find_pip_data <- function( latest_year = FALSE, @@ -228,7 +227,13 @@ find_pip_data <- function( #' @export #' #' @examples +#' \dontrun{ +#' lr <- pipfun::get_latest_pip_release() +#' pipfun::setup_working_release(release = lr$release, +#' identity = lr$identity, +#' verbose = FALSE) #' load_pip_release_inventory() +#' } load_pip_release_inventory <- \( version = NULL, verbose = getOption("pipload.verbose"), @@ -261,7 +266,13 @@ load_pip_release_inventory <- \( #' @export #' #' @examples +#' \dontrun{ +#' lr <- pipfun::get_latest_pip_release() +#' pipfun::setup_working_release(release = lr$release, +#' identity = lr$identity, +#' verbose = FALSE) #' load_pip_master_inventory() +#' } load_pip_master_inventory <- \( format = "qs2", version = NULL, @@ -299,12 +310,14 @@ load_pip_master_inventory <- \( #' @keywords internal #' #' @examples -#' check_pip_id_name("AGO_2000_HBS_CON_GPWG.qs") +#' \dontrun{ +#' check_pip_id_name("AGO_2000_HBS_CON_GPWG.qs2") #' check_pip_id_name("AGO_2000_HBS_CON_GPWG") +#' } check_pip_id_name <- \(id_name) { id_name <- id_name |> fs::path_ext_remove() |> - fs::path(ext = "qs") + fs::path(ext = "qs2") ptt <- get_from_piploadenv("pip_name_pattern") diff --git a/R/pip_load_all_aux.R b/R/pip_load_all_aux.R index 0c6212d..0189890 100644 --- a/R/pip_load_all_aux.R +++ b/R/pip_load_all_aux.R @@ -53,11 +53,11 @@ pip_load_all_aux <- function(replace = NULL, purrr::map2(.x = aux_dirs, .y = aux_indicators, .f = ~{ - fqs <- fs::path(.x, .y, ext = "qs") + fqs2 <- fs::path(.x, .y, ext = "qs2") ffst <- fs::path(.x, .y, ext = "fst") frds <- fs::path(.x, .y, ext = "rds") - f_exists <- purrr::map_lgl(c(ffst, frds, fqs), fs::file_exists) + f_exists <- purrr::map_lgl(c(ffst, frds, fqs2), fs::file_exists) any(f_exists) }) diff --git a/R/pip_merge_aux.R b/R/pip_merge_aux.R index 6287802..89f8323 100644 --- a/R/pip_merge_aux.R +++ b/R/pip_merge_aux.R @@ -11,7 +11,9 @@ #' @export #' #' @examples +#' \dontrun{ #' pip_merge_aux() +#' } pip_merge_aux <- function(tables = c("cpi", "ppp"), ppp_year = 2017, branch = c("DEV", "PROD", "main"), @@ -98,7 +100,9 @@ pip_merge_aux <- function(tables = c("cpi", "ppp"), #' @export #' #' @examples +#' \dontrun{ #' aux_ids() +#' } aux_ids <- function(tables = NULL) { l <- list() diff --git a/man/aux_ids.Rd b/man/aux_ids.Rd index 67a8a49..119bdf1 100644 --- a/man/aux_ids.Rd +++ b/man/aux_ids.Rd @@ -17,5 +17,7 @@ list of ids per table list of ID variables in auxiliary tables } \examples{ +\dontrun{ aux_ids() } +} diff --git a/man/load_dlw_data.Rd b/man/load_dlw_data.Rd index 366f1ff..fa39da5 100644 --- a/man/load_dlw_data.Rd +++ b/man/load_dlw_data.Rd @@ -121,7 +121,7 @@ pipfun::setup_working_release(release = lr$release, verbose = FALSE) # Using id_name -load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs") +load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs2") # without ext also works load_dlw_data(id_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG") @@ -137,10 +137,19 @@ find_dlw_data(country_code = "HRV", latest_year = TRUE) } check_dlw_id_name("HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs2") check_dlw_id_name("HRV_2011_EU-SILC_V01_m_V04_a_GMD_GPWG.fst") +\dontrun{ load_dlw_gmd_inventory() +} +\dontrun{ load_dlw_gmd_log() +} +\dontrun{ load_gmd_valid_inv() +} +\dontrun{ load_gmd_valid_log() +} +\dontrun{ load_gmd_valid_report() } -\keyword{internal} +} diff --git a/man/load_pip_data.Rd b/man/load_pip_data.Rd index 4612c1c..3f6ad85 100644 --- a/man/load_pip_data.Rd +++ b/man/load_pip_data.Rd @@ -122,8 +122,7 @@ pipfun::setup_working_release(release = lr$release, verbose = FALSE) # Using id_name -load_pip_data(id_name = "LCA_2015_SLCHBS_INC_GPWG") - +load_pip_data(id_name = "BOL_2022_EH_INC_ALL") } \dontrun{ lr <- pipfun::get_latest_pip_release() @@ -132,14 +131,28 @@ pipfun::setup_working_release(release = lr$release, verbose = FALSE) # Find data -find_pip_data(country_code = "HRV") +find_pip_data(country_code = "BOL") # Latest year in EACH module -find_pip_data(country_code = "HRV", latest_year = TRUE) +find_pip_data(country_code = "BOL", latest_year = TRUE) } +\dontrun{ +lr <- pipfun::get_latest_pip_release() +pipfun::setup_working_release(release = lr$release, + identity = lr$identity, + verbose = FALSE) load_pip_release_inventory() +} +\dontrun{ +lr <- pipfun::get_latest_pip_release() +pipfun::setup_working_release(release = lr$release, + identity = lr$identity, + verbose = FALSE) load_pip_master_inventory() -check_pip_id_name("AGO_2000_HBS_CON_GPWG.qs") +} +\dontrun{ +check_pip_id_name("AGO_2000_HBS_CON_GPWG.qs2") check_pip_id_name("AGO_2000_HBS_CON_GPWG") } +} \keyword{internal} diff --git a/man/pip_load_aux.Rd b/man/pip_load_aux.Rd index 1b4f4d3..1ea8d41 100644 --- a/man/pip_load_aux.Rd +++ b/man/pip_load_aux.Rd @@ -64,6 +64,7 @@ data.table Load any auxiliary data } \examples{ +\dontrun{ # Load CPI cpi <- pip_load_aux("cpi") @@ -78,7 +79,6 @@ av <- pip_load_aux(measure, version = "available") head(av) df <- pip_load_aux(measure, version = av[1]) head(df) -\dontrun{ df <- pip_load_aux(measure, version = -1) head(df) df <- pip_load_aux(measure, version = "pick") diff --git a/man/pip_merge_aux.Rd b/man/pip_merge_aux.Rd index 6aae163..6bb7897 100644 --- a/man/pip_merge_aux.Rd +++ b/man/pip_merge_aux.Rd @@ -34,5 +34,7 @@ data.table Merge auxiliary PIP tables } \examples{ +\dontrun{ pip_merge_aux() } +} diff --git a/vignettes/read_write_pins.Rmd b/vignettes/read_write_pins.Rmd index 20e340c..679f004 100644 --- a/vignettes/read_write_pins.Rmd +++ b/vignettes/read_write_pins.Rmd @@ -83,24 +83,26 @@ Below are some real-world examples of how you might use these higher-level funct ```{r load_dlw_data} # Get the latest release and set up the working environment lr <- pipfun::get_latest_pip_release() -pipfun::setup_working_release(release = lr$release, - identity = lr$identity, - verbose = FALSE) +pipfun::setup_working_release( + release = lr$release, + identity = lr$identity, + verbose = FALSE +) # Using pin_name (with extension) -load_dlw_data(pin_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs") |> +load_dlw_data(pin_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG.qs2") |> head() # Using pin_name (without extension also works) -load_dlw_data(pin_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG") |> +load_dlw_data(pin_name = "HRV_2011_EU-SILC_V01_M_V04_A_GMD_GPWG") |> head() # Using country and year -load_dlw_data(country_code = "HRV", year = 2011) |> +load_dlw_data(country_code = "HRV", year = 2011) |> head() # Find all data for a country -find_dlw_data(country_code = "HRV") |> +find_dlw_data(country_code = "HRV") |> head() # Find the latest year in EACH module for a country