Skip to content

Commit

Permalink
export loadFile()
Browse files Browse the repository at this point in the history
with #389
  • Loading branch information
achubaty committed May 16, 2024
1 parent 681c4f6 commit cfb4f3c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ URL:
https://reproducible.predictiveecology.org,
https://github.com/PredictiveEcology/reproducible
Date: 2024-05-16
Version: 2.0.12.9013
Version: 2.0.12.9014
Authors@R:
c(person(given = "Eliot J B",
family = "McIntire",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export(internetExists)
export(isUpdated)
export(linkOrCopy)
export(listNamed)
export(loadFile)
export(loadFromCache)
export(makeMemoisable)
export(makeRelative)
Expand Down
13 changes: 12 additions & 1 deletion R/DBI.R
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ dbConnectAll <- function(drv = getDrv(getOption("reproducible.drv", NULL)),
#' - `CacheDBFiles()` (i.e,. plural) returns the name of all the database files for
#' a given Cache when `useDBI() == TRUE`, or `NULL` if `FALSE`;
#' - `CacheStoredFile()` returns the file path to the file with the specified hash value,
#' This can be loaded to memory with e.g., `loadFile()`.;
#' This can be loaded to memory with e.g., [loadFile()].;
#'
#' @export
#' @rdname CacheHelpers
Expand Down Expand Up @@ -859,6 +859,17 @@ movedCache <- function(new, old, drv = getDrv(getOption("reproducible.drv", NULL
return(invisible())
}


#' Load a file from the cache
#'
#' @param file character specifying the path to the file
#'
#' @param format (optional) character string specifying file extension "qs" or "rds" of `file`;
#' if not specified (i.e., NULL), will be deduced from the file extension of `file`.
#'
#' @return the object loaded from `file`
#'
#' @export
loadFile <- function(file, format = NULL) {
if (is.null(format)) {
format <- fileExt(file)
Expand Down
2 changes: 1 addition & 1 deletion man/CacheHelpers.Rd

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

20 changes: 20 additions & 0 deletions man/loadFile.Rd

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

0 comments on commit cfb4f3c

Please sign in to comment.