How to load various types of files in R.

This function has two roles: 1) to proceed with the loading of files that are in a simList or 2) as a short cut to simInit(inputs = filelist). Generally not to be used by a user.

A data.frame with information on how to load various types of files in R, containing the columns:

• exts: the file extension;

• fun: the function to use for files with this file extension;

• package: the package from which to load fun.

Because of the environment slot, this is not quite as straightforward as just saving the object. This also has option for file-backed Rasters.

.fileExtensions()

# S4 method for simList,missing

# S4 method for missing,ANY

# S4 method for missing,missing

.saveFileExtensions()

saveSimList(sim, filename, keepFileBackedAsIs, envir = parent.frame())

## Arguments

sim simList object. list or data.frame to call loadFiles directly from the filelist as described in Details Additional arguments. Character string with the path for saving simList Logical. If there are file-backed Raster objects, should they be kept in their file-backed format, or loaded into RAM and saved within the .RData file. If TRUE (default), then the files will be copied to file.path(dirname(filename), "rasters"). environment to search for objects to be saved.

## Value

A saved .RData file in filename location.

inputs

## Examples

# NOT RUN {
# Load random maps included with package
filelist <- data.frame(
files = dir(system.file("maps", package = "quickPlot"),
full.names = TRUE, pattern = "tif"),
functions = "rasterToMemory", package = "quickPlot"
)
sim1 <- loadFiles(filelist = filelist)
clearPlot()
if (interactive()) Plot(sim1\$DEM)

# Second, more sophisticated. All maps loaded at time = 0, and the last one is reloaded
#  at time = 10 and 20 (via "intervals").
# Also, pass the single argument as a list to all functions...
#  specifically, when add "native = TRUE" as an argument to the raster function
files = dir(system.file("maps", package = "quickPlot"),
full.names = TRUE, pattern = "tif")
arguments = I(rep(list(native = TRUE), length(files)))
filelist = data.frame(
files = files,
functions = "raster::raster",
objectName = NA,
arguments = arguments,
# }