R/pxweb_load_save.R

Defines functions load_pxweb_api_subpath load_pxweb_config load_pxweb_calls load_pxweb save_pxweb

Documented in load_pxweb load_pxweb_api_subpath load_pxweb_calls load_pxweb_config save_pxweb

#' Save and load \code{pxweb} objects from R temp folder
#'
#' @param obj a \code{pxweb} object
#' @keywords internal
save_pxweb <- function(obj) {
  checkmate::assert_class(obj, "pxweb")
  save(obj, file = obj$paths$rda_file_path, compress = FALSE)
}

#' @keywords internal
#' @rdname save_pxweb
load_pxweb <- function(obj) {
  assert_pxweb_rda_file_path(obj)
  load_path <- obj$paths$rda_file_path
  rm(obj)
  load(load_path)
  obj
}

#' @keywords internal
#' @rdname save_pxweb
load_pxweb_calls <- function(obj) {
  load_pxweb(obj)$calls
}

#' @keywords internal
#' @rdname save_pxweb
load_pxweb_config <- function(obj) {
  load_pxweb(obj)$config
}

#' @keywords internal
#' @rdname save_pxweb
load_pxweb_api_subpath <- function(obj) {
  load_pxweb(obj)$paths$api_subpath
}

Try the pxweb package in your browser

Any scripts or data that you put into this service are public.

pxweb documentation built on May 29, 2024, 2:28 a.m.