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

> ### Name: cir
> ### Title: Identify pixels in a circle or ring (donut) around an object.
> ### Aliases: cir
> 
> ### ** Examples
> 
> library(data.table)
> library(sp)
> library(raster)

Attaching package: ‘raster’

The following object is masked from ‘package:data.table’:

    shift

> library(quickPlot)
> 
> set.seed(1642)
> 
> # circle centred
> ras <- raster(extent(0, 15, 0, 15), res = 1, val = 0)
> middleCircle <- cir(ras)
> ras[middleCircle[, "indices"]] <- 1
> circlePoints <- SpatialPoints(middleCircle[, c("x", "y")])
> if (interactive()) {
+   clearPlot()
+   Plot(ras)
+   Plot(circlePoints, addTo = "ras")
+ }
> 
> # circles non centred
> ras <- randomPolygons(ras, numTypes = 4)
> n <- 2
> agent <- SpatialPoints(coords = cbind(x = stats::runif(n, xmin(ras), xmax(ras)),
+                                       y = stats::runif(n, xmin(ras), xmax(ras))))
> 
> cirs <- cir(ras, agent, maxRadius = 15, simplify = TRUE)
> cirsSP <- SpatialPoints(coords = cirs[, c("x", "y")])
> cirsRas <- raster(ras)
> cirsRas[] <- 0
> cirsRas[cirs[, "indices"]] <- 1
> 
> if (interactive()) {
+   clearPlot()
+   Plot(ras)
+   Plot(cirsRas, addTo = "ras", cols = c("transparent", "#00000055"))
+   Plot(agent, addTo = "ras")
+   Plot(cirsSP, addTo = "ras")
+ }
> 
> # Example comparing rings and cir
> a <- raster(extent(0, 30, 0, 30), res = 1)
> hab <- gaussMap(a, speedup = 1) # if raster is large (>1e6 pixels) use speedup > 1
> radius <- 4
> n <- 2
> coords <- SpatialPoints(coords = cbind(x = stats::runif(n, xmin(hab), xmax(hab)),
+                                        y = stats::runif(n, xmin(hab), xmax(hab))))
> 
> # cirs
> cirs <- cir(hab, coords, maxRadius = rep(radius, length(coords)), simplify = TRUE)
> 
> # rings
> loci <- cellFromXY(hab, coordinates(coords))
> cirs2 <- rings(hab, loci, maxRadius = radius, minRadius = radius - 1, returnIndices = TRUE)
Error in `[.data.table`(d, , `:=`(duplicated, duplicated(indices)), by = id) : 
  SETLENGTH() cannot be applied to an ALTVEC object.
Calls: rings -> rings -> spread -> spread -> [ -> [.data.table
Execution halted