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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: outputs
> ### Title: Simulation outputs
> ### Aliases: outputs outputs,simList-method outputs<-
> ###   outputs<-,simList-method outputArgs outputArgs,simList-method
> ###   outputArgs<- outputArgs<-,simList-method
> 
> ### ** Examples
> 
> #######################
> # outputs
> #######################
> 
> library(igraph) # for %>%

Attaching package: ‘igraph’

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

    decompose, spectrum

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

    union

> 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))
Setting:
  options(
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
  )
Paths set to:
  options(
    rasterTmpDir = '/tmp/RtmpxIGNH2/raster'
    reproducible.cachePath = '/tmp/RtmpxIGNH2/myProject/cache'
    spades.inputPath = '/tmp/RtmpxIGNH2/myProject/inputs'
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
    spades.modulePath = '/tmp/RtmpxIGNH2/myProject/modules'
  )
> outputs(sim) # To see what will be saved, when, what filename
  objectName                                       file     fun package
1    tempObj /tmp/RtmpxIGNH2/outputs/tempObj_year10.rds saveRDS    base
  saveTime saved arguments
1       10    NA        NA
> sim <- spades(sim)
Sep13 17:32:49 chckpn total elpsd: 9e-04 secs | 0 checkpoint init 0
Sep13 17:32:49 save   total elpsd: 0.0044 secs | 0 save init 0
Sep13 17:32:49 prgrss total elpsd: 0.0085 secs | 0 progress init 0
Sep13 17:32:49 load   total elpsd: 0.012 secs | 0 load init 0
Sep13 17:32:49 save   total elpsd: 0.015 secs | 10 save spades 10
simList saved in
 SpaDES.core:::.pkgEnv$.sim 
It will be deleted at next spades() call.
> outputs(sim) # To see that it was saved, when, what filename
  objectName                                       file     fun package
1    tempObj /tmp/RtmpxIGNH2/outputs/tempObj_year10.rds saveRDS    base
  saveTime saved arguments
1       10  TRUE        NA
> 
> # Also can add using assignment after a simList object has been made
> sim <- simInit(objects = c("tempObj"), paths = list(outputPath = tmpdir))
Setting:
  options(
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
  )
Paths set to:
  options(
    rasterTmpDir = '/tmp/RtmpxIGNH2/raster'
    reproducible.cachePath = '/tmp/RtmpxIGNH2/myProject/cache'
    spades.inputPath = '/tmp/RtmpxIGNH2/myProject/inputs'
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
    spades.modulePath = '/tmp/RtmpxIGNH2/myProject/modules'
  )
> outputs(sim) <- data.frame(objectName = "tempObj", saveTime = 1:10)
> sim <- spades(sim)
Sep13 17:32:50 chckpn total elpsd: 0.00081 secs | 0 checkpoint init 0
Sep13 17:32:50 save   total elpsd: 0.0041 secs | 0 save init 0
Sep13 17:32:50 prgrss total elpsd: 0.0078 secs | 0 progress init 0
Sep13 17:32:50 load   total elpsd: 0.011 secs | 0 load init 0
Sep13 17:32:50 save   total elpsd: 0.014 secs | 1 save spades 10
Sep13 17:32:50 save   total elpsd: 0.024 secs | 2 save later 10
Sep13 17:32:50 save   total elpsd: 0.036 secs | 3 save later 10
Sep13 17:32:50 save   total elpsd: 0.046 secs | 4 save later 10
Sep13 17:32:50 save   total elpsd: 0.057 secs | 5 save later 10
Sep13 17:32:50 save   total elpsd: 0.069 secs | 6 save later 10
Sep13 17:32:50 save   total elpsd: 0.081 secs | 7 save later 10
Sep13 17:32:50 save   total elpsd: 0.092 secs | 8 save later 10
Sep13 17:32:50 save   total elpsd: 0.1 secs | 9 save later 10
Sep13 17:32:50 save   total elpsd: 0.11 secs | 10 save later 10
simList saved in
 SpaDES.core:::.pkgEnv$.sim 
It will be deleted at next spades() call.
> outputs(sim) # To see that it was saved, when, what filename.
   objectName saveTime                                       file     fun
1     tempObj        1 /tmp/RtmpxIGNH2/outputs/tempObj_year01.rds saveRDS
2     tempObj        2 /tmp/RtmpxIGNH2/outputs/tempObj_year02.rds saveRDS
3     tempObj        3 /tmp/RtmpxIGNH2/outputs/tempObj_year03.rds saveRDS
4     tempObj        4 /tmp/RtmpxIGNH2/outputs/tempObj_year04.rds saveRDS
5     tempObj        5 /tmp/RtmpxIGNH2/outputs/tempObj_year05.rds saveRDS
6     tempObj        6 /tmp/RtmpxIGNH2/outputs/tempObj_year06.rds saveRDS
7     tempObj        7 /tmp/RtmpxIGNH2/outputs/tempObj_year07.rds saveRDS
8     tempObj        8 /tmp/RtmpxIGNH2/outputs/tempObj_year08.rds saveRDS
9     tempObj        9 /tmp/RtmpxIGNH2/outputs/tempObj_year09.rds saveRDS
10    tempObj       10 /tmp/RtmpxIGNH2/outputs/tempObj_year10.rds saveRDS
   package saved arguments
1     base  TRUE        NA
2     base  TRUE        NA
3     base  TRUE        NA
4     base  TRUE        NA
5     base  TRUE        NA
6     base  TRUE        NA
7     base  TRUE        NA
8     base  TRUE        NA
9     base  TRUE        NA
10    base  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))
Setting:
  options(
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
  )
Paths set to:
  options(
    rasterTmpDir = '/tmp/RtmpxIGNH2/raster'
    reproducible.cachePath = '/tmp/RtmpxIGNH2/myProject/cache'
    spades.inputPath = '/tmp/RtmpxIGNH2/myProject/inputs'
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
    spades.modulePath = '/tmp/RtmpxIGNH2/myProject/modules'
  )
> 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)
Sep13 17:32:50 chckpn total elpsd: 0.00085 secs | 0 checkpoint init 0
Sep13 17:32:50 save   total elpsd: 0.0042 secs | 0 save init 0
Sep13 17:32:50 prgrss total elpsd: 0.0081 secs | 0 progress init 0
Sep13 17:32:50 load   total elpsd: 0.011 secs | 0 load init 0
Sep13 17:32:50 save   total elpsd: 0.014 secs | 1 save spades 10
Sep13 17:32:50 save   total elpsd: 0.026 secs | 2 save later 10
Sep13 17:32:50 save   total elpsd: 0.036 secs | 4 save later 10
Sep13 17:32:50 save   total elpsd: 0.047 secs | 6 save later 10
Sep13 17:32:50 save   total elpsd: 0.058 secs | 7 save later 10
Sep13 17:32:50 save   total elpsd: 0.07 secs | 10 save later 10
simList saved in
 SpaDES.core:::.pkgEnv$.sim 
It will be deleted at next spades() call.
> outputs(sim)
  objectName saveTime       fun package
1    tempObj        1   saveRDS    base
2    tempObj        4   saveRDS    base
3   tempObj2        2   saveRDS    base
4   tempObj2        6   saveRDS    base
5   tempObj2        7   saveRDS    base
6        df1       10 write.csv   utils
                                         file saved arguments
1  /tmp/RtmpxIGNH2/outputs/tempObj_year01.rds  TRUE        NA
2  /tmp/RtmpxIGNH2/outputs/tempObj_year04.rds  TRUE        NA
3 /tmp/RtmpxIGNH2/outputs/tempObj2_year02.rds  TRUE        NA
4 /tmp/RtmpxIGNH2/outputs/tempObj2_year06.rds  TRUE        NA
5 /tmp/RtmpxIGNH2/outputs/tempObj2_year07.rds  TRUE        NA
6      /tmp/RtmpxIGNH2/outputs/df1_year10.csv  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))
> newObj
   col1   col2
1     1  val 1
2     2  val 2
3     3  val 3
4     4  val 4
5     5  val 5
6     6  val 6
7     7  val 7
8     8  val 8
9     9  val 9
10   10 val 10
> 
> # using saving with SpaDES-aware methods
> # To see current ones SpaDES can do
> .saveFileExtensions()
  exts         fun package
1  rds     saveRDS    base
2   qs       qsave      qs
5  grd writeRaster  raster
4  csv   write.csv   utils
3  txt write.table   utils
> 
> library(raster)
Loading required package: sp
> if (require(rgdal)) {
+   ras <- raster(ncol = 4, nrow = 5)
+   ras[] <- 1:20
+ 
+   sim <- simInit(objects = c("ras"), paths = list(outputPath = tmpdir))
+   outputs(sim) = data.frame(
+     file = "test",
+     fun = "writeRaster",
+     package = "raster",
+     objectName = "ras",
+     stringsAsFactors = FALSE)
+ 
+   outputArgs(sim)[[1]] <- list(format = "GTiff") # see ?raster::writeFormats
+   simOut <- spades(sim)
+   outputs(simOut)
+   newRas <- raster(dir(tmpdir, full.name = TRUE, pattern = ".tif"))
+   all.equal(newRas, ras) # Should be TRUE
+ }
Loading required package: rgdal
Please note that rgdal will be retired by the end of 2023,
plan transition to sf/stars/terra functions using GDAL and PROJ
at your earliest convenience.

rgdal: version: 1.5-25, (SVN revision 1143)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.3.2, released 2021/09/01
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE 
Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
Path to PROJ shared files: /home/hornik/.local/share/proj:/usr/share/proj
PROJ CDN enabled: FALSE
Linking to sp version:1.4-5
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
Setting:
  options(
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
  )
Paths set to:
  options(
    rasterTmpDir = '/tmp/RtmpxIGNH2/raster'
    reproducible.cachePath = '/tmp/RtmpxIGNH2/myProject/cache'
    spades.inputPath = '/tmp/RtmpxIGNH2/myProject/inputs'
    spades.outputPath = '/tmp/RtmpxIGNH2/outputs'
    spades.modulePath = '/tmp/RtmpxIGNH2/myProject/modules'
  )
Sep13 17:32:50 chckpn total elpsd: 0.00078 secs | 0 checkpoint init 0
Sep13 17:32:50 save   total elpsd: 0.0039 secs | 0 save init 0
Sep13 17:32:50 prgrss total elpsd: 0.0074 secs | 0 progress init 0
Sep13 17:32:50 load   total elpsd: 0.01 secs | 0 load init 0
Sep13 17:32:50 save   total elpsd: 0.013 secs | 10 save spades 10
simList saved in
 SpaDES.core:::.pkgEnv$.sim 
It will be deleted at next spades() call.
Warning in if (x == "" | x == ".") { :
  the condition has length > 1 and only the first element will be used
Warning in if (!start %in% c("htt", "ftp")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (fileext %in% c(".GRD", ".GRI")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (!file.exists(x)) { :
  the condition has length > 1 and only the first element will be used
Warning in if ((fileext %in% c(".HE5", ".NC", ".NCF", ".NC4", ".CDF", ".NCDF",  :
  the condition has length > 1 and only the first element will be used
Warning in if (fileext == ".GRD") { :
  the condition has length > 1 and only the first element will be used
Warning in if (fileext %in% c(".BIN")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (fileext == ".DOC") { :
  the condition has length > 1 and only the first element will be used
Warning in if (fileext %in% c(".SGRD", ".SDAT")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (nchar(filename) == 0) stop("empty file name") :
  the condition has length > 1 and only the first element will be used
Warning in if (file.exists(file)) { :
  the condition has length > 1 and only the first element will be used
Warning in if (nchar(filename) == 0) stop("empty file name") :
  the condition has length > 1 and only the first element will be used
Warning in if (file.exists(file)) { :
  the condition has length > 1 and only the first element will be used
Warning in if (!file.exists(x)) { :
  the condition has length > 1 and only the first element will be used
Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer",  : 
  Cannot create a RasterLayer object from this file.
Calls: raster -> raster -> .local -> .rasterObjectFromFile
Execution halted