# NOT RUN {
library(sp)
# Make 2 objects
caribou1 <- SpatialPoints(cbind(x = stats::runif(10, -50, 50), y = stats::runif(10, -50, 50)))
caribou2 <- SpatialPoints(cbind(x = stats::runif(10, -50, 50), y = stats::runif(10, -50, 50)))
caribouTraj <- makeLines(caribou1, caribou2)
  if (interactive()) {
    clearPlot()
    Plot(caribouTraj, length = 0.1)
  }
# or  to a previous Plot
# }
# NOT RUN {
filelist <- data.frame(files =
     dir(file.path(find.package("SpaDES", quiet = FALSE), "maps"),
         full.names = TRUE, pattern = "tif"),
     functions = "rasterToMemory",
     packages = "SpaDES")
# Load files to memory (using rasterToMemory)
sim1 <- loadFiles(filelist = filelist)
caribouTraj <- makeLines(caribou1, caribou2)
  if (interactive()) {
    clearPlot()
    Plot(sim1$DEM)
    Plot(caribouTraj, addTo = "sim1$DEM", length = 0.1)
  }
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab