error in project function when only hinge features
ptitle opened this issue · comments
If only hinge features are used to model the niche, the project function crashes:
library(raster)
library(ENMeval)
library(rmaxent)
library(dismo)
args <- ENMeval::make.args(RMvalues=1, fc='H')[[1]]
fnames <- list.files(system.file('ex', package='dismo'), '\\.grd$', full.names=TRUE)
predictors <- stack(fnames)
predictors <- dropLayer(predictors, 'biome')
occurrence <- system.file('ex/bradypus.csv', package='dismo')
occ <- read.table(occurrence, header=TRUE, sep=',')[,-1]
me <- maxent(predictors, occ, args=args)
pred <- project(me, predictors)
Error in lfx_all[[nrow(lambdas$other) + i]] <- lambdas$hinge$lambda[i] * :
attempt to select less than one element in OneIndex