- Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathload_providers.R
29 lines (29 loc) · 966 Bytes
/
load_providers.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#' Load an updated cache
#'
#' @export
#' @param path location where cache is located. Leaving to NULL loads
#' the version in the installed package
#' @param envir R environment to load data in to.
#' @details Loads the data object providers into the global workspace.
#' @return loads the object providers into the working space.
#' @seealso [update_providers()]
#' @examples \dontrun{
#' # By default the new providers table goes to directory ".", so just
#' # load from there
#' update_providers()
#' load_providers(path=".")
#'
#' # Loads the version in the package
#' load_providers()
#' }
load_providers<-function(path=NULL, envir=.GlobalEnv) {
if (is.null(path)) {
file<- system.file("data", "providers.rda", package="oai")
} else {
files<- list.files(path)
copies<- grep("providers.rda", files)
most_recent<-files[copies[length(copies)]]
file<- paste(path, "/", most_recent, sep="")
}
load(file, envir=envir)
}