Known issues: https://github.com/PredictiveEcology/SpaDES.core/issues
igraph
RandomFields
>= 3.3.4archivist
and devtools
added to Suggests because they are used in vignettesreproducible
version 0.2.6SpaDES
simulations moved from SpaDES
package.simList
environment now has emptyenv()
as its parent.env
. The biggest user-facing changes are:
envir(sim)
(unusual, but may occur) won’t find objects in the .GlobalEnv
;parent.env
in which they are defined (little know fact identified here: http://adv-r.had.co.nz/memory.html#gc identified as a possible source of memory leaks).asNamespace("SpaDES.core")
instead of the envir(sim)
(as mentioned above), i.e,. parent.env(sim[[currentModule(sim)]])
is asNamespace("SpaDES.core")
. The main user-noticeable changes of this are that module functions will not accidentally find objects in the simList
unless they are actually passed in explicitly as arguments.mod
that works as a module-specific variable, similar to a private object, i.e., mod$a
is a local object inside the module that persists across events. It is a pointer to sim[[currentModule(sim)]]$a
scheduleConditionalEvent
, which allows an event to be scheduled based on a condition. Still experimental.objectSynonyms
, which will create active bindings of two names to a single objectmodulePath
as a character vector, e.g., simInit(..., paths = list(modulePath = c(".", "test")))
. This means that a user can organize the modules in different locations.modulePath
now has a new argument, module
, where user can specify (a) specific module(s)’s path. Modifications were implemented to dataPath
to utilize this new featuresimInit
and spades
now call setPaths(paths)
or setPaths(sim$paths)
, unsetting them on.exit
internally to make the paths used for functions e.g., reproducible::Cache
to use the correct path.inputObjects
(#83)reproducible
package updates, now uses data.table::setattr
internally to avoid copying of objects (this may have very little/no effect on simList objects)suppliedElsewhere
has a new argument, returnWhere
, a logical which will cause a logical of length 3 to be returned, indicating in which of the 3 other places the object may have been supplied, instead of length 1, still the default.
data.table
v1.12.0 (#85, @mattdowle)Copy
(error existed because function inheritance persisted even though the location of the function was moved)RandomFields
to Suggests, as it is in the Suggests of SpaDES.tools
and used in examples/tests.options("spades.saveSimOnExit" = TRUE)
. This will save the state of the simList
to an object as SpaDES.core:::.pkgEnv$.sim
, with a message, if there is a hard exist. There is virtually no computational cost to this, as the object is already in RAM.simList
internals changed. It now inherits from environment
. Amongst other things, this means that tab autocomplete in RStudio now works for objects in the simList
. Also, we removed several associated methods, $
, [[
, ls
, ls.str
, objects
, as the defaults for environments work correctly with the simList
nowdebug
arg in spades
call can now take numeric, currently 1 or 2, giving a few pre-packaged informative messaging each eventelapsedTime
which gives a summary of the clock time used by each module or eventcitation
replaces utils::citation
with an S4 generic. If package
arg is a character
, it dispatches utils::citation
; if a simList
, it gives the citation for the module(s)downloadModule()
now prints the module version downloaded (#77).inputObjects()
name conflict (internal .inputObjects
renamed to ._inputObjectsDF
; .outputObjects
renamed to ._outputObjectsDF
).inputObjects
evaluated based on module load order (#72).robustDigest
fix for simLists – needed to omit ._startClockTime
and .timestamp
sp
from importsreproducible
(>=0.2.2)spades.useRequire
: a logical which causes simInit
to load packages with Require
or require
. Lower case is generally faster, but will not handle the case of uninstalled packages, so should only be used once all packages are installed.spades.keepCompleted
: a logical which causes spades()
to keep (TRUE
) or not keep a record of completed events. Keeping track of completed events when they are many (>1e5) gets slow enough that it may be worth turning it off.tests
all.equal.simList
now removes all time dependent attributes, e.g., ._startClockTime
and .timestamp
options("spades.keepCompleted" = FALSE)
Improvements to caching of functions with simList
objects:
simList
in the arguments would erroneously return cached copies of functions. These now are copied through from argument simList
, rather than cached simList
. This means that changes to the function definitions in a module will persist (e.g., debugging via browser()
will work correctly)simList
in arguments that return a simList
will now do a post digest of the output. This will be compared with the predigest, and only those object which changed in the simList
will be modified..inputObjects
function was incorrect. Fixed.depends(sim)
FALSE
, then any error will trigger a browser()
call inside the event function. User can continue (c
) or quit (Q
) as per normal. c
will trigger a reparse and events will continue as scheduled.introduction of code checking for modules, currently turned on or off by an option spades.moduleCodeChecks
, which is TRUE
by default. Code checking includes various types:
codetools
to check for various code problemsraster::level
, raster::scale
, quickPlot::Plot
)checkCodeEnv
on every function inside a modulesim$xxx
occurrences in modules, comparing to outputObjects
in metadata if used in assignment (i.e., left hand side of assign operator), or comparing to inputObjects
if used on the right hand sideinputObjects
have default values assigned in the .inputObjects
functionspades.debug
set to TRUE
by default, instead of FALSE
. This is better for new users.moduleMetadata
argument order changed, so sim
is first, more consistent with all other simList
accessors.downloadData
has changed dramatically, now it is a wrapper around reproducible::prepInputs
which does more checking.extractURL
will extract the sourceURL from metadata, given an object name.makeMemoiseable
and unmakeMemoisable
, new methods, each the inverse of the other, to deal with imperfect memoised returns under some cases of simList
.new option, spades.keepCompleted
, TRUE
by default, which can be useful for dramatically speeding up the DES when there are many (>10,000) events.
fileExt
– use tools::file_ext
insteaddata.table
changes (@mattdowle, #64).start
and end
.newModule
template modified slightly based on workshop feedback.setPaths
now only sets the directories that are passed into it.all.equal.simList
method strips a small number of attributes that are used internally that create false failures.tools
, pryr
.rgeos
, RCurl
and googledrive
.reproducible::Require
instead of SpaDES.core::loadPackages
to load required packages. Currently, does not use version control for packages, but does use installing (from CRAN or GitHub), and loading (via require). This means a module can indicate a github package, e.g,. achubaty/amc@development
environments in modules are now as follows:
sim@.envir$<moduleName>
, and it is a is a child of sim@.envir
. Functions can be found in this environment, but prefixing functions is not necessary, because modules functions are within this environment already.sim@.envir
is a child of SpaDES.core
scoping from within a function that is defined in a module is thus:
sim@.envir$<moduleName>
–> sim@.envir
–> SpaDES.core
–> all imported packages including base
–> .GlobalEnv
–> search()
speed improvements:
data.table
objects. For small objects (e.g., the eventQueue) that have fewer than 200 objects, lists are faster. Accessors (e.g., events(sim)
, completed(sim)
) of the event queues still show data.table
objects, but these are made on the fly..parseModule
and .parseModuePartial
now put their parsed content into a temporary environment (sim@.envir$.parsedFiles$<Full Filename>)
during the simInit
, which gets re-used. Previously, files were parsed multiple times in a given simInit
call. Several functions now have envir
argument to pass this through (including moduleVersion
, packages
, checkParams
)startSimPlus1 <- start(sim) + 1
can be defined in the module and used in defineModule
grDevices
from Imports as it was not used (#1)chron
and CircStats
dependenciesdwrpnorm2
and move to package SpaDES.tools
F()
due to conflicts with F
/FALSE
.quickCheck
argumentspades.switchPkgNamespaces
which allows the user to turn off the SpaDES
feature that loads and unloads libraries specific to each module. While useful, it slows down computations, in some cases, by a lot.bug fixes:
zipModule
that omitted the checksum file from being included when data = FALSE
(#3).inputObjects
functions was evaluating outputObjects instead of inputObjects. Now corrected..inputObjects
contains arguments other than just sim, these will be evaluated as function inputs by the Cache mechanism (via .useCache), therefore correctly assessing when those inputs changed, e.g., if they are files and the arg is wrapped in asPath
, then any change to the underlying file will cause a re-cache. e.g., .inputObjects <- function(sim, importantFile = asPath(file.path(inputPath(sim), "theFile.rdata"))) { ... }
debug
option in spades()
now uses the package option spades.debug
and default is set to FALSE
(#5)P
to a function, rather than S4 generic and method, for speed.utils
due to name conflicts with raster::stack
and utils::stack
remoteFileSize
to check the size of remote filesdataPath
will return file.path(modulePath(sim), currentModule(sim), "data")
, which will return a different path, depending on which module it is placed inside.bug fix in ‘inputs’ for the case of loading objects from the global environment, either from the same object to the same object, or from different global objects overwriting on the same simList object
A new package, which takes all core DES functionality out of the SpaDES
package:
?SpaDES.core
for an overviewvarious speed improvements and bug fixes