Hi,

I have a little problem with a script that used to work fine with ESS 13-05.
This is smallest reproductible example I know and it requires to download a
jar file (maxent,jar <http://www.cs.princeton.edu/~schapire/maxent/>) and
copy this jar file it on the folder ./java  in the R dismo package.

Everytime I run this script using ESS I have a segfault but it runs
smoothly using Rstudio and the terminal  :

require(dismo)
require(rgdal)

## get predictor variables
fnames <- list.files(path=paste(system.file(package="dismo"),
                     '/ex', sep=''),
                     pattern='grd', full.names=TRUE )
predictors <- stack(fnames)
plot(predictors)

## file with presence points
occurence <- paste(system.file(package="dismo"), '/ex/bradypus.csv', sep='')
occ <- read.table(occurence, header=TRUE, sep=',')[,-1]

## witholding a 20% sample for testing
fold <- kfold(occ, k=5)
occtest <- occ[fold == 1, ]
occtrain <- occ[fold != 1, ]

## fit model, biome is a categorical variable
me <- maxent(predictors, occtrain, factors='biome')


When I remove the call to the package rgdal (which is optional in this
case) or if I call rgdal after a first dismo::maxent call and recall
dismo::maxent works fine everything:

Another weird thing is that if I insert a plot command between these two
packages call, it works too.

require(dismo)
plot(rnorm(100)
require(rgdal)
...........


So far, rgdal is the only package that show this type of behavior with ESS
when I use dismo::maxent.


My config :
R :
R version 3.0.2 Patched (2013-10-27 r64116)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
[7] base

other attached packages:
[1] rgdal_0.8-11  dismo_0.8-17  raster_2.1-49 sp_1.0-14

loaded via a namespace (and not attached):
[1] grid_3.0.2      lattice_0.20-24


ESS :
I use ESS 13-09-1 (from the latest commit of the 27th/10)

Linux (uname -a):
Linux dickoa 3.11.6-1-ARCH #1 SMP PREEMPT Fri Oct 18 23:22:36 CEST 2013
x86_64 GNU/Linux


The error I have is precisely :

 *** caught segfault ***
address 0x1072b8598, cause 'memory not mapped'

Traceback:
 1: .External(interface, obj@jobj, returnSig, method, ...)
 2: .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout,     "-s",
pfn, args), .jarray(factors))
 3: .local(x, p, ...)
 4: maxent(x, p, ...)
 5: maxent(x, p, ...)
 6: .local(x, p, ...)
 7: maxent(predictors, occtrain, factors = "biome")
 8: maxent(predictors, occtrain, factors = "biome")

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace





-- 
Ahmadou H. DICKO
statistician and applied economist (ISE)
PhD candidate in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko@ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69

	[[alternative HTML version deleted]]

