Skip to content

Error with function kfold in package dismo

3 messages · Robert J. Hijmans, Manuel Spínola

#
Dear list members,

I got this error in package "dismo".

fold <- kfold(bradypus, k=5)
 > bradytrain <- bradypus[fold != 1, ]
 > me <- maxent(predictores, bradytrain)
Error en .readRowsAscii(raster, rows[i], 1) : elemento 1 esta vacio;
   la parte de la lista de argumentos  '>' ha sido evaluada:
    (startcol, 1)

Function maxent works perfect for "bradypus" (data frame with 116 
observations), but it doesn't work for "bradytrain" when I use kfold 
function.
"bradytrain" is also a data frame but with 93 observations.  The message 
is in Sapnish, but basically say that element 1 is empty.
  Thank you very much in advance.
  Best,

Manuel
#
Manuel,

This looks like a bug in 'raster' that I think I have fixed in version
1.5-13 (should be available on R-Forge in 24 hrs or so).

As a work around, you can save ascii files to binary (once):

predictores <- writeRaster(predictores, 'predictores.grd' )
# or
predictores <- writeRaster(predictores, 'predictores.tif' )

and then in the script use:

predictores <- brick('predictores.grd')
# or
predictores <- brick('predictores.tif')


This also has the advantage of being much faster.

Robert
On Sat, Oct 2, 2010 at 3:11 PM, Manuel Sp?nola <mspinola10 at gmail.com> wrote:
#
Thank you very much Robert.
Best,

Manuel
On 02/10/2010 12:11 p.m., Robert J. Hijmans wrote: