ul(x)mkAL (x, vList, repFirst, check=TRUE)
saveSim(x, vList, repFirst, sfile, check=TRUE, doAL=TRUE)
maybeRead(sfile, msg=TRUE)
getArray(x, comp=c("value", "error", "warning", "time"),
FUN=NULL, err.value=NA)
array2df(x, responseName = "value")
list of variable specifications. Each
variable specification is itself a named list which must contain a
"value" component.repFirst
in the x <- do*Apply() call where x has been created.logical activating consistency checks for
x.NULL.logical indicating if mkAL() should
be called, or rather just x be saved.logical indicating whether a message is
printed when an object is read from sfile.numeric which is used to replace the
value of the array entry in case of an error.array is constructed.arrady2df():) a string specifying the
name of the mkAL() is useful when creating arrays from result
lists returned from large(r) simulation studies which use
doCallWE(). To create a proper argument x for
mkAL(), the function ul() turns out to
be useful to (stepwise) unlist nested lists. getArray() converts arrays of lists as returned by
mkAL() to an array of numeric (or
logical, see below) after applying the specified FUN.
In case of an error, the corresponding entry in the resulting array is
replaced by err.value.
The default FUN converts possible errors and warnings to
logical (indicating whether there was a error or
warning, respectively) and run times to numeric. For
comp="value", the situation is trickier. First of all, the
resulting array contains dimensions for variables of type
"n.sim"); see the vignette for
details.
Use FUN = identity to get at the full error or warning objects,
for comp = "error" or for comp = "warning", respectively.
saveSim() and maybeRead() are
useful for creating and (re)storing arrays from large(r) simulation
studies (to avoid recomputation, to ease the data analysis etc.).
saveSim() calls mkAL(), nowadays wrapped in
tryCatch(.), such that the simulation is not lost, even
when the resulting format cannot correctly be treated by
mkAL(). Consequently, doAL is not much needed anymore.
Note that both saveSim() and maybeRead() accept
sfile=NULL in which case nothing is saved or read.
simsalapar-package.getEl() and mkNms() used by
mkAL(). saveRDS() and
readRDS(), the saveSim() and maybeRead(), respectively.## Get at the full error objects, notably (message, call):
errObjs <- getArray(res, "error", FUN=identity)
if(FALSE) ## A longer, "interesting" example is in
demo(robust.mean)Run the code above in your browser using DataLab