lazyLoad2: Load lazy objects from a 'lazyR' database

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Load all named objects into the specified environment.

Usage

1
2
lazyLoad2(objNames = NULL, md5Hashes = NULL, lazyDir = NULL,
  envir = parent.frame(), verbose = FALSE)

Arguments

objNames

A character vector of object names to load lazily, usually from a lazyLs call. If NULL, all object in lazyDir will be loaded.

md5Hashes

Object hash.

lazyDir

Character string of directory to be used for the lazy databases.

envir

Environment into which the objects are loaded. Default is .GlobalEnv.

verbose

Logical. If notes about rasters whose file backings were corrected on the fly from previous, i.e,. wrong, filenames.

Value

Invisibly, the objects read in returned. This function is used for its side effects, i.e., loading lazy objects.

Note

Rasters have a special behaviour. If the filename associated with a raster is pointing to a file that doesn't exist, then it will try the prepend the lazyDir to the filename inside the Raster* object. The raster filenames can become incorrect if the absolute path to the file changes due to a changing of operating system or moving from a removable drive. For example, a removable drive, which was mapped to, say E: in the computer where the object was originally lazySaved, gets replugged in but mapped to F:, then the absolute paths will be wrong. This will be automatically corrected, with a warning, if the filename can be found by looking in the relative path /rasters/ below lazyDir.

Author(s)

Eliot McIntire

See Also

lazyLs, lazyRm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(SpaDES)
tmpdir <- checkPath(file.path(tempdir(), "lazyDir"), create=TRUE)
obj <- rnorm(10)
# save the obj
lazySave(obj, lazyDir=tmpdir)
# remove the obj
rm(obj)
any(ls()=="obj") # Is FALSE
# load it back in
lazyLoad2("obj", lazyDir=tmpdir)
any(ls()=="obj") # Is TRUE
unlink(tmpdir, recursive = TRUE)

PredictiveEcology/lazyR documentation built on May 8, 2019, 3:10 p.m.