I am getting and error message that I can't understand when running the code below in R
I have the following example dataset of plots x species abundances
dput(fern[1:5,c(1,3:5)])
structure(c("plot1", "plot2", "plot3", "plot4", "plot5", " 1",
" 7", " 8", " 10", " 0", "5", "3", "2", "1", "4", " 18", " 13",
" 0", " 9", " 10"), .Dim = 5:4, .Dimnames = list(NULL, c("plot",
"Actin_penn", "Actin_subt", "Adian_adia")))
and environmental data
dput(env2[1:5,-c(2)])
structure(c("plot1", "plot2", "plot3", "plot4", "plot5", "2902",
"3047", "2797", "2752", "2832", "1303", "1355", "1252", "1230",
"1272", "468", "488", "445", "444", "449", "2958", "2962", "3874",
"3874", "3782", "127", "129", "145", "147", "148"), .Dim = 5:6, .Dimnames = list(
NULL, c("plot", "Band4median15", "Band5median15", "Band7median15",
"Chelsa450bio12", "SRTM90")))
I first run the model
XData=as.data.frame(env2)
m = Hmsc(Y = fern,
XData = XData,
distr = "lognormal poisson")
and seems ok, at least no error messages.
Then I try the sample
thin = 1
samples = 500
nChains = 1
set.seed(1)
m = sampleMcmc(m, samples = samples, thin = thin,
adaptNf = rep(ceiling(0.4*samples*thin),1),
transient = ceiling(0.5*samples*thin),
nChains = nChains, nParallel = nChains)
And get
Error in checkForRemoteErrors(val) :
4 nodes produced errors; first error: non-numeric argument to binary operator
Any ideas of what is wrong?