Error in `[.data.frame`(x, , f) : undefined columns selected (in dismo)

602 views
Skip to first unread message

David Bennett

unread,
Mar 9, 2019, 11:17:56 PM3/9/19
to Maxent
Hi everyone,

Got a weird problem. I'm using dismo and R for a Maxent model and, when using the following code:

xm <- maxent(predictorsM1, pres_train, a=NULL, nbg=10000, args = "biasfile=biasfile", "replicates=10")

Get the following error:

Error in `[.data.frame`(x, , f) : undefined columns selected In addition: Warning message: In .local(x, p, ...) : 7 (0.22%) of the presence points have NA predictor values

My search attempts on this group and google as a whole would suggest the problem lies with pres_train, but none of my efforts have
worked. It is a spatial points data frame, but even changing it to a 2 column data frame doesn't work.

Would be everlastingly grateful for any help you could offer.

Kyle Marsh

unread,
Oct 14, 2020, 8:20:10 PM10/14/20
to Maxent
I had the same error, but it in my situation it was because I ran the maxent model on a predictors stack with my "data" table for species locations. I copied the code from the documentation but didn't realize factors ="biome" didn't make sense for my data.  
maxent_model <- maxent(predictors, data, factors='biome', args=c('hinge=false', 'threshold=false'))
I didn't have any categorical variables called "biome".
Once I removed that from my code the error went away. 

For your situation:
Looking at your code it looks like you are not writing the args correctly. Try args = c( "biasfile=biasfile", "replicates=10").

Hopefully that helps,
Kyle
Reply all
Reply to author
Forward
0 new messages