Parse and extract a module's version
moduleVersion(module, path, sim, envir = NULL)
# S4 method for class 'character,character,missing'
moduleVersion(module, path, envir)
# S4 method for class 'character,missing,missing'
moduleVersion(module, envir)
# S4 method for class 'character,missing,simList'
moduleVersion(module, sim, envir)Character string. Your module's name.
Character string specifying the file path to modules directory.
Default is to use the spades.modulePath option.
A simList simulation object, generally produced by simInit.
Optional environment in which to store parsed code. This may be
useful if the same file is being parsed multiple times. This
function will check in that environment for the parsed file before
parsing again. If the envir is transient, then this will have no effect.
numeric_version indicating the module's version.
# using filepath
path <- getSampleModules(tempdir())
moduleVersion("caribouMovement", path)
#> [1] ‘1.6.1’
# using simList
options("spades.useRequire" = FALSE)
if (require("SpaDES.tools", quietly = TRUE)) {
mySim <- simInit(
times = list(start = 2000.0, end = 2002.0, timeunit = "year"),
params = list(
.globals = list(stackName = "landscape", burnStats = "nPixelsBurned")
),
modules = list("caribouMovement"),
paths = list(modulePath = path)
)
moduleVersion("caribouMovement", sim = mySim)
}
#> Setting:
#> options(
#> spades.modulePath = '/tmp/RtmpJs8fIQ/sampleModules'
#> )
#> Paths set to:
#> options(
#> rasterTmpDir = '/tmp/RtmpJs8fIQ/SpaDES/scratch/raster'
#> reproducible.cachePath = '/tmp/RtmpJs8fIQ/reproducible/cache'
#> spades.inputPath = '/tmp/RtmpJs8fIQ/SpaDES/inputs'
#> spades.outputPath = '/tmp/RtmpJs8fIQ/SpaDES/outputs'
#> spades.modulePath = '/tmp/RtmpJs8fIQ/sampleModules'
#> spades.scratchPath = '/tmp/RtmpJs8fIQ/SpaDES/scratch'
#> )
#> terra::terraOptions(tempdir = '/tmp/RtmpJs8fIQ/SpaDES/scratch/terra')
#> Sep19 02:49:55 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Sep19 02:49:55 simInit The following .globals were used:
#> Sep19 02:49:55 simInit Key: <global, module>
#> Sep19 02:49:55 simInit module global
#> Sep19 02:49:55 simInit <char> <char>
#> Sep19 02:49:55 simInit 1: caribouMovement stackName
#> Sep19 02:49:55 simInit Global parameter(s) not used in any module: burnStats.
#> Elapsed time for simInit: 0.08473349 secs
#> [1] ‘1.6.1’