Skip to content

Commit

Permalink
Create activeBinding to mod object within modules
Browse files Browse the repository at this point in the history
Cache -- for simList -- include the module environment


make active binding to mod
  • Loading branch information
eliotmcintire committed Nov 28, 2018
1 parent 936f710 commit 4bee16c
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 25 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Expand Up @@ -9,8 +9,8 @@ Description: Provide the core discrete event simulation (DES) framework for
URL:
http://spades-core.predictiveecology.org/,
https://github.com/PredictiveEcology/SpaDES.core
Date: 2018-11-26
Version: 0.2.3.9004
Date: 2018-11-27
Version: 0.2.3.9005
Authors@R: c(
person("Alex M", "Chubaty", email = "alex.chubaty@gmail.com",
role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7146-8135")),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -8,6 +8,7 @@ version 0.2.3.9000
* lorem ipsum

## new features
* New active binding, `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`
* New function `scheduleConditionalEvent`, which allows an event to be scheduled based on a condition. Still experimental.
* An experimental new function and feature, `objectSynonyms`, which will create active bindings of two names to a single object
* User can now specify `modulePath` as a character vector, e.g., `simInit(..., paths = list(modulePath = c(".", "test")))`. This means that a user can organize the modules in different locations.
Expand Down
35 changes: 19 additions & 16 deletions R/cache.R
Expand Up @@ -37,14 +37,16 @@ setMethod(
quick, classOptions) {

outerObjs <- ls(object@.xData, all.names = TRUE)
moduleEnvirs <- mget(outerObjs[outerObjs %in% unlist(modules(object))], envir = object@.xData)
moduleEnvirs <- mget(outerObjs[outerObjs %in% unlist(modules(object))],
envir = object@.xData)
moduleObjs <- lapply(moduleEnvirs, function(me) ls(me, all.names = TRUE))
allObjsInSimList <- append(list(".xData" = outerObjs), moduleObjs)
allEnvsInSimList <- append(list(object@.xData), moduleEnvirs)

ord <- .orderDotsUnderscoreFirst(allObjsInSimList)
allObjsInSimList <- allObjsInSimList[ord]
allEnvsInSimList <- allEnvsInSimList[ord]
names(allEnvsInSimList) <- names(allObjsInSimList)

isObjectEmpty <- if (!missing(objects)) {
if (!is.null(objects)) {
Expand All @@ -70,15 +72,16 @@ setMethod(
} else {
objects <- allObjsInSimList
}
envirHash <- lapply(seq(allObjsInSimList), function(objs) {
objectsToDigest <- sort(allObjsInSimList[[objs]], method = "radix")
envirHash <- Map(objs = allObjsInSimList, name = names(allObjsInSimList),
function(objs, name) {
objectsToDigest <- sort(objs, method = "radix")
objectsToDigest <- objectsToDigest[objectsToDigest %in%
objects[[names(allObjsInSimList)[objs]]]]
.robustDigest(mget(objectsToDigest, envir = allEnvsInSimList[[objs]]),
objects[[name]]]
.robustDigest(mget(objectsToDigest, envir = allEnvsInSimList[[name]]),
quick = quick,
length = length)
})
names(envirHash) <- names(allObjsInSimList)
#names(envirHash) <- names(allObjsInSimList)
lens <- unlist(lapply(envirHash, function(x) length(x) > 0))
envirHash <- envirHash[lens]

Expand Down Expand Up @@ -341,6 +344,7 @@ setMethod(
algo = dots$algo,
quick = dots$quick,
classOptions = dots$classOptions)

changed <- if (length(postDigest$.list)) {
internalSimList <- unlist(lapply(preDigest[[whSimList]]$.list,
function(x) !any(startsWith(names(x), "doEvent"))))
Expand All @@ -349,7 +353,9 @@ setMethod(
} else {
which(internalSimList)
}
isNewObj <- !names(postDigest$.list[[whSimList2]]) %in% names(preDigest[[whSimList]]$.list[[whSimList2]])

isNewObj <- !names(postDigest$.list[[whSimList2]]) %in%
names(preDigest[[whSimList]]$.list[[whSimList2]])
newObjs <- names(postDigest$.list[[whSimList2]])[isNewObj]
newObjs <- newObjs[!startsWith(newObjs, "._")]
existingObjs <- names(postDigest$.list[[whSimList2]])[!isNewObj]
Expand Down Expand Up @@ -436,9 +442,10 @@ setMethod(
# makes soft copy of all objects, i.e., they have the identical objects, which are pointers only
object2 <- Copy(tmpl[[whSimList]], objects = FALSE)

hasCurrModule <- currentModule(tmpl[[whSimList]])
currModules <- currentModule(tmpl[[whSimList]])
# Convert to numeric index, as some modules don't have names
hasCurrModule <- match(hasCurrModule, modules(tmpl[[whSimList]]))
hasCurrModule <- match(currModules, modules(tmpl[[whSimList]]))
if (length(currModules) == 0) currModules <- modules(tmpl[[whSimList]])

createOutputs <- if (length(hasCurrModule)) {
tmpl[[whSimList]]@depends@dependencies[[hasCurrModule]]@outputObjects$objectName
Expand All @@ -448,8 +455,9 @@ setMethod(
unique(unlist(aa))
}
createOutputs <- na.omit(createOutputs)
createOutputs <- c(createOutputs, currModules) # add the environments for each module - allow local objects
# take only the ones that the file changed, based on attr(object, ".Cache")$changed
createOutputs <- createOutputs[createOutputs %in% attr(object, ".Cache")$changed]
changedOutputs <- createOutputs[createOutputs %in% attr(object, ".Cache")$changed]

expectsInputs <- if (length(hasCurrModule)) {
tmpl[[whSimList]]@depends@dependencies[[hasCurrModule]]@inputObjects$objectName
Expand All @@ -461,14 +469,9 @@ setMethod(

# Copy all objects from createOutputs only -- all others take from tmpl[[whSimList]]
lsObjectEnv <- ls(object@.xData, all.names = TRUE)
list2env(mget(lsObjectEnv[lsObjectEnv %in% createOutputs | lsObjectEnv %in% expectsInputs],
list2env(mget(lsObjectEnv[lsObjectEnv %in% changedOutputs | lsObjectEnv %in% expectsInputs],
envir = object@.xData), envir = object2@.xData)
if (length(object2@current)==0) { # means it is not in a spades call
# numCompleted <- if (length(object2@completed)) {
# length(unlist(object2@completed, recursive = FALSE))/(length(object2@completed[[1]]))
# } else {
# 0
# }
object2@completed <- object@completed
}
if (NROW(current(object2)) == 0) {
Expand Down
33 changes: 30 additions & 3 deletions R/copy.R
Expand Up @@ -39,11 +39,38 @@ setMethod("Copy",
sim_@events <- object@events
sim_@current <- object@current
}
sim_@.xData <- new.env(parent = asNamespace("SpaDES.core"))
attr(sim_@.xData, "name") <- "sim"
if (objects) {
sim_@.xData <- Copy(sim_@.xData, filebackedDir = cachePath(object))
} else {
sim_@.xData <- new.env(parent = asNamespace("SpaDES.core"))
objNames <- ls(object, all.names = TRUE)
names(objNames) <- objNames
isEnv <- unlist(lapply(objNames,
function(obj) is.environment(get(obj, envir = object))))
list2env(mget(objNames[!isEnv], envir = object@.xData), envir = sim_@.xData)
list2env(lapply(objNames[isEnv], function(x) {
e <- new.env(parent = sim_@.xData)
attr(e, "name") <- x
e
}
),
envir = sim_@.xData)

lapply(objNames[isEnv], function(en) {
list2env(as.list(object@.xData[[en]], all.names = TRUE),
envir = sim_@.xData[[en]])
isFn <- unlist(lapply(ls(sim_@.xData[[en]]), function(obj)
if (is.function(get(obj, envir = sim_@.xData[[en]]))) {
environment(sim_@.xData[[en]][[obj]]) <- sim_@.xData[[en]]
}
))
}
)
# list2env(Copy(mget(objNames[isEnv], envir = object@.xData), all.names = TRUE),
# filebackedDir = cachePath(object),
# envir = sim_@.xData)
}
sim_@.envir <- sim_@.xData
return(sim_)
})


21 changes: 19 additions & 2 deletions R/simulation-spades.R
Expand Up @@ -727,6 +727,20 @@ setMethod(
do.call(setPaths, append(sim@paths, list(silent = TRUE)))
on.exit({do.call(setPaths, append(list(silent = TRUE), oldGetPaths))}, add = TRUE)

# Make local activeBindings to mod
lapply(modules(sim), function(m) {
makeActiveBinding(sym = "mod",
fun = function(value){
if (missing(value)) {
get(m, envir = sim, inherits = FALSE)
} else {
stop("Can't overwrite mod")
}
},
env = sim[[m]])

})

sim@.xData[["._startClockTime"]] <- Sys.time()
.pkgEnv$searchPath <- search()
.pkgEnv[["spades.browserOnError"]] <-
Expand Down Expand Up @@ -889,11 +903,14 @@ setMethod(
moduleCall, fnEnv, cur, notOlderThan) {
if (cacheIt) { # means that a module or event is to be cached
createsOutputs <- sim@depends@dependencies[[cur[["moduleName"]]]]@outputObjects$objectName
fns <- ls(fnEnv, all.names = TRUE)
moduleSpecificObjects <-
c(ls(sim@.xData, all.names = TRUE, pattern = cur[["moduleName"]]), # functions in the main .xData that are prefixed with moduleName
ls(fnEnv, all.names = TRUE), # functions in the namespaced location
fns, # functions in the namespaced location
na.omit(createsOutputs)) # objects outputted by module
moduleSpecificOutputObjects <- createsOutputs
#fnsWOhidden <- paste0(cur[["moduleName"]], ":",
# grep("^\\._", fns, value = TRUE, invert = TRUE))
moduleSpecificOutputObjects <- c(createsOutputs, cur[["moduleName"]])
classOptions <- list(events = FALSE, current=FALSE, completed=FALSE, simtimes=FALSE,
params = sim@params[[cur[["moduleName"]]]],
modules = cur[["moduleName"]])
Expand Down
23 changes: 21 additions & 2 deletions tests/testthat/test-cache.R
Expand Up @@ -373,6 +373,8 @@ test_that("Cache of sim objects via .Cache attr -- using preDigest and postDiges
sim$co1 <- 1
sim$co2 <- 1
sim$co3 <- 1
sim$test$hi <- 1
mod$hello <- 2
",
xxx1[[1]][(lineWithInit + 1):lineWithDotInputObjects], "
aaa <- 1
Expand All @@ -385,23 +387,40 @@ test_that("Cache of sim objects via .Cache attr -- using preDigest and postDiges
params = list(test = list(.useCache = "init")))
mySim$co4 <- 5
mySim$co5 <- 6
mySim2 <- spades(mySim)
mySim2 <- spades(Copy(mySim))
expect_true(mySim2$co1 == 1)
expect_true(mySim2$co2 == 1)
expect_true(mySim2$co3 == 1)
expect_true(mySim2$co4 == 5)
expect_true(mySim2$co5 == 6)

# Test mod
expect_true(mySim2$test$hello == 2)

mySim <- simInit(paths = list(modulePath = tmpdir), modules = as.list(m[1]),
objects = list(co4 = 3, co3 = 2, co1 = 4), params =
list(test = list(.useCache = "init")))

expect_true(mySim$co3 == 2) # will be changed by init
expect_true(mySim$co1 == 4)# will be changed by init
mySim2 <- spades(mySim)
expect_true(is.null(mySim$test$hi)) # will be changed by init
mySim2 <- spades(Copy(mySim))
expect_true(mySim2$test$hi == 1) # was affected
expect_true(mySim2$co1 == 1) # was affected
expect_true(mySim2$co2 == 1)# was affected
expect_true(mySim2$co3 == 1) # was affected
expect_false(mySim2$co4 == 5) # wasn't affected by init event
expect_true(mySim2$co4 == 3) # wasn't affect by init event
expect_true(is.null(mySim2$co5)) # wan't affected, and isn't there

# Try again, hi should be there
expect_true(is.null(mySim$test$hi)) # is not in the
mess1 <- capture_output(mySim2 <- spades(Copy(mySim)))
expect_true(mySim2$test$hi == 1) # recovered in Cache
expect_true(mySim2$test$hello == 2) # recovered in Cache
expect_true(grepl("Using cached copy", mess1))

})



93 changes: 93 additions & 0 deletions tests/testthat/test-mod.R
@@ -0,0 +1,93 @@
test_that("local mod object", {
testInitOut <- testInit(smcc = FALSE, debug = FALSE)
on.exit({
testOnExit(testInitOut)
}, add = TRUE)

newModule("test", tmpdir, open = FALSE)
newModule("test2", tmpdir, open = FALSE)

sim <- simInit()

# Sept 18 2018 -- Changed to use "seconds" -- better comparison with simple loop
cat(file = file.path(tmpdir, "test", "test.R"),'
defineModule(sim, list(
name = "test",
description = "insert module description here",
keywords = c("insert key words here"),
authors = person(c("Eliot", "J", "B"), "McIntire", email = "eliot.mcintire@canada.ca", role = c("aut", "cre")),
childModules = character(0),
version = list(SpaDES.core = "0.1.0", test = "0.0.1"),
spatialExtent = raster::extent(rep(NA_real_, 4)),
timeframe = as.POSIXlt(c(NA, NA)),
timeunit = "second",
citation = list("citation.bib"),
documentation = list("README.txt", "test.Rmd"),
reqdPkgs = list(),
parameters = rbind(
),
inputObjects = bind_rows(
),
outputObjects = bind_rows(
)
))
doEvent.test = function(sim, eventTime, eventType, debug = FALSE) {
switch(
eventType,
init = {
mod$a <- 2
sim <- scheduleEvent(sim, sim@simtimes[["current"]] + 1, "test", "event1", .skipChecks = TRUE)
},
event1 = {
sim <- scheduleEvent(sim, sim@simtimes[["current"]] + 1, "test", "event1", .skipChecks = TRUE)
})
return(invisible(sim))
}
', fill = TRUE)

cat(file = file.path(tmpdir, "test2", "test2.R"),'
defineModule(sim, list(
name = "test2",
description = "insert module description here",
keywords = c("insert key words here"),
authors = person(c("Eliot", "J", "B"), "McIntire", email = "eliot.mcintire@canada.ca", role = c("aut", "cre")),
childModules = character(0),
version = list(SpaDES.core = "0.1.0", test2 = "0.0.1"),
spatialExtent = raster::extent(rep(NA_real_, 4)),
timeframe = as.POSIXlt(c(NA, NA)),
timeunit = "second",
citation = list("citation.bib"),
documentation = list("README.txt", "test2.Rmd"),
reqdPkgs = list(),
parameters = rbind(
),
inputObjects = bind_rows(
),
outputObjects = bind_rows(
)
))
doEvent.test2 = function(sim, eventTime, eventType, debug = FALSE) {
switch(
eventType,
init = {
mod$a <- 1
sim <- scheduleEvent(sim, start(sim), "test2", "event1", .skipChecks = TRUE)
},
event1 = {
mod$b <- mod$a + 1
sim <- scheduleEvent(sim, sim@simtimes[["current"]] + 2, "test2", "event1", .skipChecks = TRUE)
})
return(invisible(sim))
}
', fill = TRUE)
mySim <- simInit(times = list(start = 0, end = 0),
paths = list(modulePath = tmpdir), modules = c("test", "test2"))
out <- spades(mySim)
expect_true(out$test$a == 2)
expect_true(out$test2$a == 1)
expect_true(out$test2$b == 2)

})

1 comment on commit 4bee16c

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inst/examples/example_experiment.R:91:5: style: Commented code should be removed.

# library(raster)
    ^~~~~~~~~~~~~~~

inst/examples/example_experiment.R:92:5: style: Commented code should be removed.

# beginCluster(20) # if you have multiple clusters available, use them here to save time
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/examples/example_experiment.R:96:5: style: Commented code should be removed.

# endCluster() # end the clusters
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/examples/example_experiment.R:152:5: style: Commented code should be removed.

# fires <- lapply(sims, function(x) x$landscape$fires) %>% stack
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/examples/example_POM.R:48:5: style: Commented code should be removed.

# cl <- makeCluster(detectCores() - 1) # not implemented yet in DEoptim
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/examples/example_POM.R:83:4: style: Commented code should be removed.

#stopCluster(cl) # not yet implemented, waiting for DEoptim
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/examples/example_POM.R:106:34: style: Variable or function name should be lowerCamelCase.

​    params(sim1)$caribouMovement$N <- pars[2]
                                 ^

inst/examples/example_POM.R:113:5: style: Variable or function name should be lowerCamelCase.

nPattern_Out <- caribouFn(out$caribou)
    ^~~~~~~~~~~~

inst/examples/example_POM.R:119:7: style: Commented code should be removed.

# cat(minimizeFn)
      ^~~~~~~~~~~~~~~

inst/examples/example_POM.R:120:7: style: Commented code should be removed.

# cat(" ")
      ^~~~~~~~

inst/examples/example_POM.R:121:7: style: Commented code should be removed.

# cat(pars)
      ^~~~~~~~~

inst/examples/example_POM.R:122:7: style: Commented code should be removed.

# cat("\n")
      ^~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:1:1: style: Variable or function name should be lowerCamelCase.

SpaDES.core.version <- "0.1.0"
^~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:54:1: style: Variable or function name should be lowerCamelCase.

doEvent.caribouMovement <- function(sim, eventTime, eventType, debug = FALSE) {
^~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:78:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$moveInterval, "caribouMovement", "move")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:82:1: style: Lines should not be more than 100 characters.

​      Plot(sim$caribou, addTo = paste("sim", SpaDES.core::P(sim)$stackName, "habitatQuality", sep = "$"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:86:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$.plotInterval, "caribouMovement", "plot", .last())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:90:1: style: Lines should not be more than 100 characters.

​      Plot(sim$caribou, addTo = paste("sim", SpaDES.core::P(sim)$stackName, "habitatQuality", sep = "$"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:95:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$.plotInterval, "caribouMovement", "plot", .last())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:102:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$.saveInterval, "caribouMovement", "save", .last() + 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/caribouMovement/caribouMovement.R:114:1: style: Variable or function name should be lowerCamelCase.

Init <- function(sim) {
^~~~

inst/sampleModules/caribouMovement/caribouMovement.R:121:3: style: Variable or function name should be lowerCamelCase.

N <- SpaDES.core::P(sim)$N
  ^

inst/sampleModules/caribouMovement/caribouMovement.R:122:3: style: Variable or function name should be lowerCamelCase.

IDs <- as.character(1:N)
  ^~~

inst/sampleModules/caribouMovement/caribouMovement.R:138:1: style: Variable or function name should be lowerCamelCase.

Move <- function(sim) {
^~~~

inst/sampleModules/fireSpread/fireSpread.R:1:1: style: Variable or function name should be lowerCamelCase.

SpaDES.core.version <- "0.1.0"
^~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:20:1: style: Lines should not be more than 100 characters.

​    person(c("Alex", "M"), "Chubaty", email = "alexander.chubaty@canada.ca", role = c("aut", "cre")),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:21:1: style: Lines should not be more than 100 characters.

​    person(c("Eliot", "J", "B"), "McIntire", email = "eliot.mcintire@canada.ca", role = c("aut", "cre")),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:35:1: style: Lines should not be more than 100 characters.

​    defineParameter("persistprob", "numeric", 0.00, 0, 1, "probability of fire persisting in a pixel"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:37:1: style: Lines should not be more than 100 characters.

​    defineParameter("spreadprob", "numeric", 0.225, 0.05, 0.5, "probability of fire spreading into a pixel"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:38:1: style: Lines should not be more than 100 characters.

​    defineParameter("startTime", "numeric", start(sim) + 1, 0, end(sim), "time of initial fire ignition"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:39:1: style: Lines should not be more than 100 characters.

​    defineParameter(".plotInitialTime", "numeric", start(sim), start(sim), end(sim) + 1, "time to schedule first plot event"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:41:1: style: Lines should not be more than 100 characters.

​    defineParameter(".saveInitialTime", "numeric", NA_real_, NA, NA, "time to schedule first save event"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:42:1: style: Lines should not be more than 100 characters.

​    defineParameter(".saveInterval", "numeric", NA_real_, NA, NA, "time interval between save events")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:45:1: style: Lines should not be more than 100 characters.

​    expectsInput(objectName = SpaDES.core::P(sim, "fireSpread")$stackName, objectClass = "RasterStack",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:51:1: style: Lines should not be more than 100 characters.

​    createsOutput(objectName = SpaDES.core::P(sim, "fireSpread")$stackName, objectClass = "RasterStack",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:59:1: style: Variable or function name should be lowerCamelCase.

doEvent.fireSpread <- function(sim, eventTime, eventType, debug = FALSE) {
^~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:80:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, SpaDES.core::P(sim)$.plotInitialTime, "fireSpread", "plot.init", .last())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:87:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim), "fireSpread", "stats") # do stats immediately following burn
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:88:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$returnInterval, "fireSpread", "burn")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:108:1: style: Lines should not be more than 100 characters.

stackName <- SpaDES.core::P(sim)$stackName # Plot doesn't like long names -- create local variable
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/fireSpread/fireSpread.R:143:1: style: Variable or function name should be lowerCamelCase.

Init <- function(sim) {
^~~~

inst/sampleModules/fireSpread/fireSpread.R:147:3: style: Variable or function name should be lowerCamelCase.

Fires <- raster(extent(landscapes), ncol = ncol(landscapes),
  ^~~~~

inst/sampleModules/fireSpread/fireSpread.R:151:3: style: Variable or function name should be lowerCamelCase.

Fires <- setValues(Fires, 0)
  ^~~~~

inst/sampleModules/fireSpread/fireSpread.R:154:14: style: Variable or function name should be lowerCamelCase.

landscapes$Fires <- Fires
             ^~~~~

inst/sampleModules/fireSpread/fireSpread.R:160:1: style: Variable or function name should be lowerCamelCase.

Burn <- function(sim) {
^~~~

inst/sampleModules/fireSpread/fireSpread.R:163:3: style: Variable or function name should be lowerCamelCase.

Fires <- spread(landscapes[[1]],
  ^~~~~

inst/sampleModules/fireSpread/fireSpread.R:175:14: style: Variable or function name should be lowerCamelCase.

landscapes$Fires <- Fires
             ^~~~~

inst/sampleModules/fireSpread/fireSpread.R:182:1: style: Variable or function name should be lowerCamelCase.

Stats <- function(sim) {
^~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:1:1: style: Variable or function name should be lowerCamelCase.

SpaDES.core.version <- "0.1.0"
^~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:33:1: style: Lines should not be more than 100 characters.

​    defineParameter("inRAM", "logical", FALSE, TRUE, FALSE, "should the raster be stored in memory?"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:34:1: style: Lines should not be more than 100 characters.

​    defineParameter("nx", "numeric", 100L, 10L, 500L, "size of map (number of pixels) in the x dimension"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:35:1: style: Lines should not be more than 100 characters.

​    defineParameter("ny", "numeric", 100L, 10L, 500L, "size of map (number of pixels) in the y dimension"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:37:1: style: Lines should not be more than 100 characters.

​    defineParameter(".plotInitialTime", "numeric", start(sim), start(sim), NA, "time to schedule first plot event"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:38:1: style: Lines should not be more than 100 characters.

​    defineParameter(".plotInterval", "numeric", NA_real_, NA, NA, "time interval between plot events"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:39:1: style: Lines should not be more than 100 characters.

​    defineParameter(".saveInitialTime", "numeric", NA_real_, NA, NA, "time to schedule first save event"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:40:1: style: Lines should not be more than 100 characters.

​    defineParameter(".saveInterval", "numeric", NA_real_, NA, NA, "time interval between save events"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:41:1: style: Lines should not be more than 100 characters.

​    defineParameter(".useCache", "logical", FALSE, c("init", "plot"), NA, "should the module result be cached for future use")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:49:1: style: Lines should not be more than 100 characters.

​    createsOutput(objectName = SpaDES.core::P(sim, "randomLandscapes")$stackName, objectClass = "RasterStack",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:55:1: style: Variable or function name should be lowerCamelCase.

doEvent.randomLandscapes <- function(sim, eventTime, eventType, debug = FALSE) {
^~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:63:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, SpaDES.core::P(sim)$.plotInitialTime, "randomLandscapes", "plot", .last())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:64:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, SpaDES.core::P(sim)$.saveInitialTime, "randomLandscapes", "save", .last() + 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:76:1: style: Lines should not be more than 100 characters.

sim <- scheduleEvent(sim, time(sim) + SpaDES.core::P(sim)$.saveInterval, "randomLandscapes", "save", .last() + 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:87:1: style: Variable or function name should be lowerCamelCase.

Init <- function(sim) {
^~~~

inst/sampleModules/randomLandscapes/randomLandscapes.R:101:5: style: Variable or function name should be lowerCamelCase.

DEM <- gaussMap(template, scale = 300, var = 0.03, speedup = speedup, inMemory = inMemory)
    ^~~

inst/sampleModules/SpaDES_sampleModules/SpaDES_sampleModules.R:17:1: style: Lines should not be more than 100 characters.

​    defineParameter(".plotInitialTime", "numeric", NA_real_, NA, NA, "This describes the simulation time at which the first plot event should occur"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inst/sampleModules/SpaDES_sampleModules/SpaDES_sampleModules.R:18:1: style: Lines should not be more than 100 characters.

​    defineParameter(".saveInitialTime", "numeric", NA_real_, NA, NA, "This describes the simulation time at which the first save event should occur")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:84:6: style: Commented code should be removed.

#names(envirHash) <- names(allObjsInSimList)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:133:22: style: Variable or function name should be lowerCamelCase.

obj$.list[[1]]$._startClockTime <- NULL
                     ^~~~~~~~~~~~~~~~

R/cache.R:134:22: style: Variable or function name should be lowerCamelCase.

obj$.list[[1]]$._timestamp <- NULL
                     ^~~~~~~~~~~

R/cache.R:241:50: style: Commas should always have a space after.

​          cat(crayon::blue("  Using ", fromWhere," copy of", cur$moduleName, "module\n"))
                                                 ^

R/cache.R:252:50: style: Commas should always have a space after.

​          cat(crayon::blue("  Using ", fromWhere," copy of", cur$eventType, "event in",
                                                 ^

R/cache.R:302:10: style: Commented code should be removed.

#checkPath(cacheRepo, create = TRUE) #SpaDES dependency
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:363:1: style: Lines should not be more than 100 characters.

pre <- lapply(preDigest[[whSimList]]$.list[[whSimList2]][existingObjs], fastdigest::fastdigest)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:442:1: style: Lines should not be more than 100 characters.

#   makes soft copy of all objects, i.e., they have the identical objects, which are pointers only
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:458:1: style: Lines should not be more than 100 characters.

createOutputs <- c(createOutputs, currModules) # add the environments for each module - allow local objects
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:474:36: style: Put spaces around all infix operators.

if (length(object2@current)==0) { # means it is not in a spades call
                                  ~^~~

R/cache.R:474:41: style: Opening curly braces should never go on their own line and should always be followed by a new line.

if (length(object2@current)==0) { # means it is not in a spades call
                                        ^

R/cache.R:483:63: style: Put spaces around all infix operators.

eventsAddedByThisModule <- events(object)$moduleName==current(object2)$moduleName
                                                             ~^~~

R/cache.R:487:42: style: Opening curly braces should never go on their own line and should always be followed by a new line.

b <- lapply(b, function(x) {x[["order"]] <- 2; x})
                                         ^

R/cache.R:490:42: style: Opening curly braces should never go on their own line and should always be followed by a new line.

d <- lapply(d, function(x) {x[["order"]] <- 1; x})
                                         ^

R/cache.R:497:1: style: Lines should not be more than 100 characters.

#              args = list(append(object@events[eventsAddedByThisModule], object2@events)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:500:56: style: Opening curly braces should never go on their own line and should always be followed by a new line.

object2@events <- lapply(f1, function(f) {f$order <- NULL; f})
                                                       ^

R/cache.R:502:1: style: Lines should not be more than 100 characters.

#                           args = list(append(object@events[eventsAddedByThisModule], object2@events)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:505:12: style: Commented code should be removed.

#object2@events <- unique(rbindlist(list(object@events, object2@events)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:509:1: style: Lines should not be more than 100 characters.

# This is for objects that are not in the return environment yet because they are unrelated to the
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:522:10: style: Place a space before left parenthesis, except in a function call.

for(atts in attrsToGrab) {
         ^

R/cache.R:526:9: style: Commented code should be removed.

# attr(object2, "tags") <- attr(object, "tags")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:527:9: style: Commented code should be removed.

# attr(object2, "call") <- attr(object, "call")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:528:9: style: Commented code should be removed.

# attr(object2, "function") <- attr(object, "function")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:561:66: style: Variable or function name should be lowerCamelCase.

setGeneric(".addTagsToOutput", function(object, outputObjects, FUN) {
                                                                 ^~~

R/cache.R:584:48: style: Variable or function name should be lowerCamelCase.

definition = function(object, outputObjects, FUN, preDigestByClass) {
                                               ^~~

R/cache.R:677:1: style: Variable or function name should be lowerCamelCase.

objSize.simList <- function(x, quick = getOption("reproducible.quick", FALSE)) {
^~~~~~~~~~~~~~~

R/cache.R:704:1: style: Variable or function name should be lowerCamelCase.

makeMemoiseable.simList <- function(x) {
^~~~~~~~~~~~~~~~~~~~~~~

R/cache.R:712:1: style: Variable or function name should be lowerCamelCase.

unmakeMemoiseable.simList_ <- function(x) {
^~~~~~~~~~~~~~~~~~~~~~~~~~

R/check.R:151:7: style: Commented code should be removed.

# modules <- sim@modules
      ^~~~~~~~~~~~~~~~~~~~~~

R/check.R:152:7: style: Commented code should be removed.

# userModules <- modules[-which(coreModules %in% modules)]
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/checkpoint.R:36:1: style: Variable or function name should be lowerCamelCase.

doEvent.checkpoint <- function(sim, eventTime, eventType, debug = FALSE) {
^~~~~~~~~~~~~~~~~~

R/code-checking.R:86:1: style: Lines should not be more than 100 characters.

xAsCall <- .isLastLineSim(x = x, xAsString = bb[seq(funStarts[yy], funEnds[yy + 1])])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:90:16: style: Commented code should be removed.

#y = strsplit(bb[funStarts[yy]], split = "\\s+")[[1]][1]
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:91:53: style: Commas should always have a space after.

y <- paste0(cantCodeCheckMessage, "'",bb[funStarts[yy]], "'")
                                                    ^

R/code-checking.R:144:39: style: Opening curly braces should never go on their own line and should always be followed by a new line.

if (identical(type, "returnSim")) { # This is intended for only the last line of a function
                                      ^

R/code-checking.R:182:48: style: Do not place spaces around code in parentheses or square brackets.

​      } else if (identical(x[[1]], quote(`<-`)) ) {
                                               ^

R/code-checking.R:185:62: style: Opening curly braces should never go on their own line and should always be followed by a new line.

if (any(grepl(x[[2]][[2]], pattern = ".xData"))) {# i.e., sim@.xData
                                                             ^

R/code-checking.R:202:19: style: Place a space before left parenthesis, except in a function call.

x <- x[-(1:2)]
                  ^

R/code-checking.R:218:29: style: Place a space before left parenthesis, except in a function call.

x[[2]] <- x[[2]][-(1:2)]
                            ^

R/code-checking.R:320:1: style: Lines should not be more than 100 characters.

allChecks[anyCantCodeCheck] <- lapply(names(cantCodeCheck[anyCantCodeCheck]), function(objName) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:369:51: style: Commas should always have a space after.

" ",verb," declared in outputObjects, ",
                                                  ^

R/code-checking.R:369:56: style: Commas should always have a space after.

" ",verb," declared in outputObjects, ",
                                                       ^

R/code-checking.R:385:20: style: Commas should always have a space after.

" ",verb," declared in inputObjects, ",
                   ^

R/code-checking.R:385:25: style: Commas should always have a space after.

" ",verb," declared in inputObjects, ",
                        ^

R/code-checking.R:396:90: style: Commas should always have a space after.

​                                       paste0(paste(missingFrmMod, collapse = ", "), " ",verb,
                                                                                         ^

R/code-checking.R:441:75: style: Commas should always have a space after.

" but only for the 'get' functions, not the 'set' function ","
                                                                          ^

R/code-checking.R:455:1: style: Lines should not be more than 100 characters.

missingInMetadata <- simAssignsNotInDotInputObjects[!(simAssignsNotInDotInputObjects %in% outputObjNames)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:464:24: style: Commas should always have a space after.

" ",verbs[[fn]]," assigned to sim inside ",
                       ^

R/code-checking.R:464:36: style: Commas should always have a space after.

" ",verbs[[fn]]," assigned to sim inside ",
                                   ^

R/code-checking.R:465:33: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in outputObjects")
                                ^

R/code-checking.R:465:45: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in outputObjects")
                                            ^

R/code-checking.R:472:1: style: Lines should not be more than 100 characters.

missingInMetadata <- simAssignsInDotInputObjects[!(simAssignsInDotInputObjects %in% inputObjNames)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:481:24: style: Commas should always have a space after.

" ",verbs[[fn]]," assigned to sim inside ",
                       ^

R/code-checking.R:481:36: style: Commas should always have a space after.

" ",verbs[[fn]]," assigned to sim inside ",
                                   ^

R/code-checking.R:482:33: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in inputObjects")
                                ^

R/code-checking.R:482:45: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in inputObjects")
                                            ^

R/code-checking.R:504:24: style: Commas should always have a space after.

" ",verbs[[fn]]," used from sim inside ",
                       ^

R/code-checking.R:504:36: style: Commas should always have a space after.

" ",verbs[[fn]]," used from sim inside ",
                                   ^

R/code-checking.R:505:33: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in inputObjects")
                                ^

R/code-checking.R:505:45: style: Commas should always have a space after.

fn, ", but ",verbs[[fn]]," not declared in inputObjects")
                                            ^

R/code-checking.R:517:13: style: Commas should always have a space after.

" ",verb," used from sim inside ",
            ^

R/code-checking.R:517:18: style: Commas should always have a space after.

" ",verb," used from sim inside ",
                 ^

R/code-checking.R:519:18: style: Commas should always have a space after.

", but ",verb," not declared in inputObjects"
                 ^

R/code-checking.R:519:23: style: Commas should always have a space after.

", but ",verb," not declared in inputObjects"
                      ^

R/code-checking.R:662:6: style: Commented code should be removed.

#unique(pd[outerWh, "line1"])
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/code-checking.R:666:34: style: Commas should always have a space after.

whInner <- any((pd[outerWh,"line1"] < lwf) & (pd[outerWh,"line2"] > lwf) )
                                 ^

R/code-checking.R:666:64: style: Commas should always have a space after.

whInner <- any((pd[outerWh,"line1"] < lwf) & (pd[outerWh,"line2"] > lwf) )
                                                               ^

R/code-checking.R:666:79: style: Do not place spaces around code in parentheses or square brackets.

whInner <- any((pd[outerWh,"line1"] < lwf) & (pd[outerWh,"line2"] > lwf) )
                                                                              ^

R/copy.R:37:13: style: Variable or function name should be lowerCamelCase.

sim_ <- object
            ^~~~

R/copy.R:75:1: style: Trailing blank lines are superfluous.

^

R/copy.R:76:1: style: Trailing blank lines are superfluous.

^

R/downloadData.R:54:96: style: Do not place spaces around code in parentheses or square brackets.

io <- .parseModulePartial(sim, modules = list(module), defineModuleElement = "inputObjects" )
                                                                                               ^

R/downloadData.R:244:7: style: Commented code should be removed.

# parsedModule <- parse(file = file.path(path, module, paste0(module, '.R')))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/downloadData.R:245:7: style: Commented code should be removed.

# urls <- .getSourceURL(pattern = fileToDownload, x = parsedModule)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/downloadData.R:252:8: style: Commented code should be removed.

#urls <- moduleMetadata(module, path)$inputObjects$sourceURL
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/downloadData.R:277:27: style: Commas should always have a space after.

chksums2 <- chksums[0,]
                          ^

R/downloadData.R:278:6: style: Commented code should be removed.

#children <- moduleMetadata(module, path)$childModules
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/downloadData.R:281:13: style: Do not place spaces around code in parentheses or square brackets.

if ( all( nzchar(children) & !is.na(children) ) ) {
            ^

R/downloadData.R:281:18: style: Do not place spaces around code in parentheses or square brackets.

if ( all( nzchar(children) & !is.na(children) ) ) {
                 ^

R/downloadData.R:281:54: style: Do not place spaces around code in parentheses or square brackets.

if ( all( nzchar(children) & !is.na(children) ) ) {
                                                     ^

R/downloadData.R:281:56: style: Do not place spaces around code in parentheses or square brackets.

if ( all( nzchar(children) & !is.na(children) ) ) {
                                                       ^

R/experiment.R:214:7: style: Commented code should be removed.

# cl <- tryCatch(getCluster(), error = function(x) NULL)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/experiment.R:215:7: style: Commented code should be removed.

# on.exit(if (!is.null(cl)) returnCluster(), add = TRUE)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/experiment.R:217:6: style: Commented code should be removed.

#if (length(modules) == 0) modules <- list(modules(sim)[-(1:4)])
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/experiment.R:221:11: style: Commented code should be removed.

# unlist(params[paramsTmp], recursive = FALSE)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/experiment.R:313:58: style: Commented code should be removed.

​            params(sim_)[[mod[x]]][[param[[x]]]] <- val #factorialExp[ind,x]
                                                         ^~~~~~~~~~~~~~~~~~~

R/experiment.R:356:11: style: Variable or function name should be lowerCamelCase.

sim_ <- sim
          ^~~~

R/helpers.R:232:74: style: Place a space before left parenthesis, except in a function call.

​                             paste0("package:", .pkgEnv$corePackagesVec[-(1:2)]))
                                                                         ^

R/helpers.R:264:1: style: Variable or function name should be lowerCamelCase.

all.equal.simList <- function(target, current, ...) {
^~~~~~~~~~~~~~~~~

R/helpers.R:280:5: style: Commented code should be removed.

# suppressWarnings(rm("._startClockTime", envir = envir(target)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/helpers.R:281:5: style: Commented code should be removed.

# suppressWarnings(rm("._startClockTime", envir = envir(current)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/helpers.R:282:5: style: Commented code should be removed.

# suppressWarnings(rm("._firstEventClockTime", envir = envir(target)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/helpers.R:283:5: style: Commented code should be removed.

# suppressWarnings(rm("._firstEventClockTime", envir = envir(current)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/helpers.R:284:5: style: Commented code should be removed.

# suppressWarnings(rm(".timestamp", envir = envir(target)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/helpers.R:285:5: style: Commented code should be removed.

# suppressWarnings(rm(".timestamp", envir = envir(current)))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/load.R:198:1: style: Lines should not be more than 100 characters.

​                names(argument) <- c(nam, names(formals(getFromNamespace(loadFun[y], loadPackage[y])))[1])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/misc-methods.R:466:55: style: Do not place spaces around code in parentheses or square brackets.

​          (inherits(get(w, envir = envir), "integer")) ) {
                                                      ^

R/misc-methods.R:645:1: style: Variable or function name should be lowerCamelCase.

Paths <- .paths()
^~~~~

R/misc-methods.R:661:14: style: Variable or function name should be lowerCamelCase.

defaults$CP <- TRUE
             ^~

R/misc-methods.R:665:14: style: Variable or function name should be lowerCamelCase.

defaults$IP <- TRUE
             ^~

R/misc-methods.R:669:14: style: Variable or function name should be lowerCamelCase.

defaults$MP <- TRUE
             ^~

R/misc-methods.R:673:14: style: Variable or function name should be lowerCamelCase.

defaults$OP <- TRUE
             ^~

R/misc-methods.R:694:73: style: Commas should always have a space after.

if (!defaults$CP) paste0("    reproducible.cachePath = '",normPath(cachePath),"'\n"),
                                                                        ^

R/misc-methods.R:694:93: style: Commas should always have a space after.

if (!defaults$CP) paste0("    reproducible.cachePath = '",normPath(cachePath),"'\n"),
                                                                                            ^

R/misc-methods.R:695:67: style: Commas should always have a space after.

if (!defaults$IP) paste0("    spades.inputPath = '",normPath(inputPath),"'\n"),
                                                                  ^

R/misc-methods.R:695:87: style: Commas should always have a space after.

if (!defaults$IP) paste0("    spades.inputPath = '",normPath(inputPath),"'\n"),
                                                                                      ^

R/misc-methods.R:696:68: style: Commas should always have a space after.

if (!defaults$OP) paste0("    spades.outputPath = '",normPath(outputPath),"'\n"),
                                                                   ^

R/misc-methods.R:696:89: style: Commas should always have a space after.

if (!defaults$OP) paste0("    spades.outputPath = '",normPath(outputPath),"'\n"),
                                                                                        ^

R/misc-methods.R:697:68: style: Commas should always have a space after.

if (!defaults$MP) paste0("    spades.modulePath = '",modPaths,
                                                                   ^

R/misc-methods.R:704:48: style: Commas should always have a space after.

"    reproducible.cachePath = '",normPath(cachePath),"'\n",
                                               ^

R/misc-methods.R:704:68: style: Commas should always have a space after.

"    reproducible.cachePath = '",normPath(cachePath),"'\n",
                                                                   ^

R/misc-methods.R:705:42: style: Commas should always have a space after.

"    spades.inputPath = '",normPath(inputPath),"'\n",
                                         ^

R/misc-methods.R:705:62: style: Commas should always have a space after.

"    spades.inputPath = '",normPath(inputPath),"'\n",
                                                             ^

R/misc-methods.R:706:43: style: Commas should always have a space after.

"    spades.outputPath = '",normPath(outputPath),"'\n",
                                          ^

R/misc-methods.R:706:64: style: Commas should always have a space after.

"    spades.outputPath = '",normPath(outputPath),"'\n",
                                                               ^

Please sign in to comment.