[R-sig-Geo] error when converting shapefile to psp object in spatstat

david.march at uib.es david.march at uib.es
Wed Apr 6 12:11:16 CEST 2011

Dear all,

I'm trying to convert a shapefile into psp object of spatstat, but I  
found an error message. I'm following the guidelness provided here:  

#script following the instructions with a sample shapefile from maptools:
spatstat.options(gpclib=TRUE) #here I suspect is only relevant for  
importing polygon data

setwd(system.file("shapes", package = "maptools"))
fylk <- readShapeSpatial("fylk-val.shp")
fdata <- slot(fylk, "data")
fl <- as(fylk, "SpatialLines")
fcurves <- slot(fl, "lines")
fcurves <- lapply(fcurves, function(x) {SpatialLines(list(x))})
fpatterns <- lapply(fcurves, as.psp)

Here I get the following message error:
Error en as.data.frame.vector(x, ..., nm = nm) :   el argumento formal  
"nm" concuerda con múltiples argumentos especificados

# also the same problem when trying:
x <- as.psp(fylk)

# and also here:

I'm running R version 2.12.2  for windows with the following version packages:
spatstat 1.21-6
General Polygon Clipper Library for R (version 1.5-1)
maptools 0.8-6

Any about what is this error regarding some "nm" formal argument?

Thanks in advance,

David March Morla
Doctorando / PhD student
Instituto Mediterraneo de Estudios Avanzados (UIB-CSIC)
C/Miquel Marques,21
07190 Esporles
Islas Baleares - Spain
Tel: +34 971 611 722
Fax: +34 971 611 761
Email: david.march at uib.es

More information about the R-sig-Geo mailing list