-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathgl.load.r
47 lines (40 loc) · 1.39 KB
/
gl.load.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#' Loads an object from compressed binary format produced by gl.save()
#'
#' This is a wrapper for readRDS()
#'
#' The script loads the object from the current workspace and returns the
#' gl object.
#'
#' @param file Name of the file to receive the binary version of the object
#' [required].
#' @param verbose Verbosity: 0, silent or fatal errors; 1, begin and end; 2,
#' progress log; 3, progress and results summary; 5, full report
#' [default 2 or as specified using gl.set.verbosity].
#' @return The loaded object
#' @export
#' @author Custodian: Arthur Georges -- Post to
#' \url{https://groups.google.com/d/forum/dartr}
#' @examples
#' gl.save(testset.gl,file.path(tempdir(),'testset.rds'))
#' gl <- gl.load(file.path(tempdir(),'testset.rds'))
#' @seealso \code{\link{gl.save}}
#'
gl.load <- function(file,
verbose = NULL) {
# SET VERBOSITY
verbose <- gl.check.verbosity(verbose)
# FLAG SCRIPT START
funname <- match.call()[[1]]
utils.flag.start(func = funname,
build = "Jody",
verbosity = verbose)
x <- readRDS(file)
# CHECK DATATYPE
datatype <- utils.check.datatype(x, verbose = verbose)
cat(report(" Loaded object of type", datatype, "from", file, "\n"))
# FLAG SCRIPT END
if (verbose > 0) {
cat(report("Completed:", funname, "\n"))
}
invisible(x)
}