johnbaums / rmaxent

Tools for working with Maxent in R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

commented

Thanks @ptitle for the issue, and sorry I didn't see it until now.