Running examples in ‘SpaDES.core-Ex.R’ failed
The error most likely occurred in:

> ### Name: inputs
> ### Title: Inputs and outputs
> ### Aliases: inputs simList-accessors-inout inputs,.simList-method inputs<-
> ###   inputs<- inputs<-,.simList-method outputs outputs,.simList-method
> ###   outputs<- outputs<- outputs<-,.simList-method inputArgs
> ###   inputArgs,.simList-method inputArgs<- inputArgs<-
> ###   inputArgs<-,.simList-method outputArgs outputArgs,.simList-method
> ###   outputArgs<- outputArgs<- outputArgs<-,.simList-method
> 
> ### ** Examples
> 
> #######################
> # inputs
> #######################
> 
> # Start with a basic empty simList
> sim <- simInit()
> 
> test <- 1:10
> library(igraph) # for %>%

Attaching package: ‘igraph’

The following object is masked from ‘package:reproducible’:

    %>%

The following objects are masked from ‘package:stats’:

    decompose, spectrum

The following object is masked from ‘package:base’:

    union

> library(reproducible) # for checkPath
> tmpdir <- file.path(tempdir(), "inputs") %>% checkPath(create = TRUE)
> tmpFile <- file.path(tmpdir, "test.rds")
> saveRDS(test, file = tmpFile)
> inputs(sim) <- data.frame(file = tmpFile) # using only required column, "file"
> inputs(sim) # see that it is not yet loaded, but when it is scheduled to be loaded
                             file     fun package objectName loadTime loaded
1 /tmp/Rtmpc.aO5z/inputs/test.rds readRDS    base       test        0     NA
  arguments intervals
1        NA        NA
> simOut <- spades(sim)
test read from /tmp/Rtmpc.aO5z/inputs/test.rds using readRDS
> inputs(simOut) # confirm it was loaded
                             file     fun package objectName loadTime loaded
1 /tmp/Rtmpc.aO5z/inputs/test.rds readRDS    base       test        0   TRUE
  arguments intervals
1        NA        NA
> simOut$test
 [1]  1  2  3  4  5  6  7  8  9 10
> 
> # can put data.frame for inputs directly inside simInit call
> allTifs <- dir(system.file("maps", package = "quickPlot"),
+                full.names = TRUE, pattern = "tif")
> 
> # next: .objectNames are taken from the filenames (without the extension)
> # This will load all 5 tifs in the SpaDES sample directory, using
> #   the raster fuction in the raster package, all at time = 0
> if (require("rgdal", quietly = TRUE)) {
+   sim <- simInit(
+     inputs = data.frame(
+       files = allTifs,
+       functions = "raster",
+       package = "raster",
+       loadTime = 0,
+       stringsAsFactors = FALSE)
+     )
+ 
+   ##############################
+   #A fully described inputs object, including arguments:
+   files <- dir(system.file("maps", package = "quickPlot"),
+                full.names = TRUE, pattern = "tif")
+   # arguments must be a list of lists. This may require I() to keep it as a list
+   #   once it gets coerced into the data.frame.
+   arguments = I(rep(list(native = TRUE), length(files)))
+   filelist = data.frame(
+      objectName = paste0("Maps", 1:5),
+      files = files,
+      functions = "raster::raster",
+      arguments = arguments,
+      loadTime = 0,
+      intervals = c(rep(NA, length(files) - 1), 10)
+   )
+   inputs(sim) <- filelist
+   spades(sim)
+ }
rgdal: version: 1.3-1, (SVN revision 747)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.2.4, released 2018/03/19
 Path to GDAL shared files: /usr/local/share/gdal
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 5.0.1, April 1st, 2018, [PJ_VERSION: 501]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-7 
DEM read from /home/ripley/R/Lib32/quickPlot/maps/DEM.tif using raster(inMemory=FALSE)
forestAge read from /home/ripley/R/Lib32/quickPlot/maps/forestAge.tif using raster(inMemory=FALSE)
forestCover read from /home/ripley/R/Lib32/quickPlot/maps/forestCover.tif using raster(inMemory=FALSE)
habitatQuality read from /home/ripley/R/Lib32/quickPlot/maps/habitatQuality.tif using raster(inMemory=FALSE)
percentPine read from /home/ripley/R/Lib32/quickPlot/maps/percentPine.tif using raster(inMemory=FALSE)
Maps1 read from /home/ripley/R/Lib32/quickPlot/maps/DEM.tif using raster(inMemory=FALSE)
Maps2 read from /home/ripley/R/Lib32/quickPlot/maps/forestAge.tif using raster(inMemory=FALSE)
Maps3 read from /home/ripley/R/Lib32/quickPlot/maps/forestCover.tif using raster(inMemory=FALSE)
Maps4 read from /home/ripley/R/Lib32/quickPlot/maps/habitatQuality.tif using raster(inMemory=FALSE)
Maps5 read from /home/ripley/R/Lib32/quickPlot/maps/percentPine.tif using raster(inMemory=FALSE)
Maps5 read from /home/ripley/R/Lib32/quickPlot/maps/percentPine.tif using raster(inMemory=FALSE)
  at time 10
> 
>   # Example showing loading multiple objects from global environment onto the
>   #   same object in the simList, but at different load times
>   a1 <- 1
>   a2 <- 2
>   # Note arguments must be a list of NROW(inputs), with each element itself being a list,
>   #  which is passed to do.call(fun[x], arguments[[x]]), where x is row number, one at a time
>   args <- lapply(1:2, function(x) {
+                  list(x = paste0("a", x),
+                       envir = environment()) # may be necessary to specify in which envir a1, a2
+                                              # are located, if not in an interactive sessino
+                  })
>   inputs <- data.frame(objectName = "a", loadTime = 1:2, fun = "base::get", arguments = I(args))
>   a <- simInit(inputs = inputs, times = list(start = 0, end = 1))
>   a <- spades(a)
a loaded into simList
>   identical(a1, a$a)
[1] TRUE
> 
>   end(a) <- 3
>   a <- spades(a) # different object (a2) loaded onto a$a
a loaded into simList
>   identical(a2, a$a)
[1] TRUE
> 
> # Clean up after
> unlink(tmpdir, recursive = TRUE)
> 
> #######################
> # outputs
> #######################
> 
> library(igraph) # for %>%
> tmpdir <- file.path(tempdir(), "outputs") %>% checkPath(create = TRUE)
> tmpFile <- file.path(tmpdir, "temp.rds")
> tempObj <- 1:10
> 
> # Can add data.frame of outputs directly into simInit call
> sim <- simInit(objects = c("tempObj"),
+                outputs = data.frame(objectName = "tempObj"),
+                paths = list(outputPath = tmpdir))
> outputs(sim) # To see what will be saved, when, what filename
  objectName                                   file     fun package saveTime
1    tempObj /tmp/Rtmpc.aO5z/outputs/tempObj_year10 saveRDS    base       10
  saved arguments
1    NA        NA
> sim <- spades(sim)
> outputs(sim) # To see that it was saved, when, what filename
  objectName                                   file     fun package saveTime
1    tempObj /tmp/Rtmpc.aO5z/outputs/tempObj_year10 saveRDS    base       10
  saved arguments
1  TRUE        NA
> 
> # Also can add using assignment after a simList object has been made
> sim <- simInit(objects = c("tempObj"), paths = list(outputPath = tmpdir))
> outputs(sim) <- data.frame(objectName = "tempObj", saveTime = 1:10)
> sim <- spades(sim)
> outputs(sim) # To see that it was saved, when, what filename.
   objectName saveTime                                   file     fun package
1     tempObj        1 /tmp/Rtmpc.aO5z/outputs/tempObj_year01 saveRDS    base
2     tempObj        2 /tmp/Rtmpc.aO5z/outputs/tempObj_year02 saveRDS    base
3     tempObj        3 /tmp/Rtmpc.aO5z/outputs/tempObj_year03 saveRDS    base
4     tempObj        4 /tmp/Rtmpc.aO5z/outputs/tempObj_year04 saveRDS    base
5     tempObj        5 /tmp/Rtmpc.aO5z/outputs/tempObj_year05 saveRDS    base
6     tempObj        6 /tmp/Rtmpc.aO5z/outputs/tempObj_year06 saveRDS    base
7     tempObj        7 /tmp/Rtmpc.aO5z/outputs/tempObj_year07 saveRDS    base
8     tempObj        8 /tmp/Rtmpc.aO5z/outputs/tempObj_year08 saveRDS    base
9     tempObj        9 /tmp/Rtmpc.aO5z/outputs/tempObj_year09 saveRDS    base
10    tempObj       10 /tmp/Rtmpc.aO5z/outputs/tempObj_year10 saveRDS    base
   saved arguments
1   TRUE        NA
2   TRUE        NA
3   TRUE        NA
4   TRUE        NA
5   TRUE        NA
6   TRUE        NA
7   TRUE        NA
8   TRUE        NA
9   TRUE        NA
10  TRUE        NA
> 
> # can do highly variable saving
> tempObj2 <- paste("val",1:10)
> df1 <- data.frame(col1 = tempObj, col2 = tempObj2)
> sim <- simInit(objects = c("tempObj", "tempObj2", "df1"),
+   paths=list(outputPath = tmpdir))
> outputs(sim) = data.frame(
+      objectName = c(rep("tempObj", 2), rep("tempObj2", 3), "df1"),
+      saveTime = c(c(1,4), c(2,6,7), end(sim)),
+      fun = c(rep("saveRDS", 5), "write.csv"),
+      package = c(rep("base", 5), "utils"),
+      stringsAsFactors = FALSE)
> # since write.csv has a default of adding a column, x, with rownames, must add additional
> #   argument for 6th row in data.frame (corresponding to the write.csv function)
> outputArgs(sim)[[6]] <- list(row.names=FALSE)
> sim <- spades(sim)
> outputs(sim)
  objectName saveTime       fun package                                    file
1    tempObj        1   saveRDS    base  /tmp/Rtmpc.aO5z/outputs/tempObj_year01
2    tempObj        4   saveRDS    base  /tmp/Rtmpc.aO5z/outputs/tempObj_year04
3   tempObj2        2   saveRDS    base /tmp/Rtmpc.aO5z/outputs/tempObj2_year02
4   tempObj2        6   saveRDS    base /tmp/Rtmpc.aO5z/outputs/tempObj2_year06
5   tempObj2        7   saveRDS    base /tmp/Rtmpc.aO5z/outputs/tempObj2_year07
6        df1       10 write.csv   utils      /tmp/Rtmpc.aO5z/outputs/df1_year10
  saved arguments
1  TRUE        NA
2  TRUE        NA
3  TRUE        NA
4  TRUE        NA
5  TRUE        NA
6  TRUE     FALSE
> 
> # read one back in just to test it all worked as planned
> newObj <- read.csv(dir(tmpdir, pattern = "year10.csv", full.name = TRUE))
Error in file(file, "rt") : invalid 'description' argument
Calls: read.csv -> read.table -> file
Execution halted