'Raster: "error in evaluating the argument 'x' in selecting a method for function 'is.factor':"

I am taking some of my R code and running it through a cluster. All of the code works through R. However, I am having issues with the cluster. I am trying to create a bunch of maps for point sampling. The first error I get is when trying to interpolate digital elevation models from modern day and the Pliocene DEM.

Here's a subset of of the code.

library(doParallel)
library(dplyr)
library(dismo)
library(caret)
library(sp)
library(raster)
library(rgl)
library(fields)
library(mgcv)
library(reshape2)
library(rgeos)
library(tidyr)
library(rgdal)
library(sphereplot)
library(base)

load("MyData.Rdata")
test <- DEMmod+(((DEMplio-DEMmod)/5000)*1)

However, this test returns an error:

Error in h(simpleError(msg, call)) :
  error in evaluating the argument 'x' in selecting a method for function 'is.factor':
Calls: - ... initialize -> .local -> .Call -> .handleSimpleError -> h
Execution halted

Any ideas for what might be going on and why it works on my desktop and not cluster?



Solution 1:[1]

Answer was simple. I was importing an R workspace into the cluster and trying to load data from here. This won't work with rasters. The rasters files need to be copied into the cluster and loaded into R from here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SamN