
Dear forum, 

  

I am working in R 2.9.1 and I am trying to sample locations from a network file. Reading in nor plotting is a problem, however when I am trying to sample from the file I get the following message: 

  

nwlim<-readShapeLines("C:/Limburg_nwshape", proj4string=CRS("+init=epsg:31300")) 

plot(nwlim) 

  

randacc<-spsample(nwlim,n=1000,"random") 

Error in function (classes, fdef, mtable)  : 

  unable to find an inherited method for function "coordinates", for signature "numeric" 

  

  

I found a similar error message in the archives, where prof. dr. Bivand indicated to try to use readOGR instead of readShapeLines, however, I get the same error message. 

  

  

nwlim2<-readOGR("C:/Limburg_nwshape.shp", "Limburg_nwshape") 

OGR data source with driver: ESRI Shapefile 

Source: "C:/Limburg_nwshape.shp", layer: "Limburg_nwshape" 

with  60745  rows and  24  columns 

Feature type: wkbLineString with 2 dimensions 

  

randacc<-spsample(nwlim2,n=1000,"random") 

Error in function (classes, fdef, mtable)  : 

  unable to find an inherited method for function "coordinates", for signature "numeric" 

  

  

Can anyone help me with this issue? The shape file in itself is not so large (only a province was taken instead of the entire file of Belgium because of memory issues), only 8.11Mb. 

  

Thanks in advance! 

  

Elke 

  

__________________________________________

Elke Moons, PhD

Instituut voor Mobiliteit/Transportation Research Institute

Universiteit Hasselt

Wetenschapspark 5/Lokaal 1.10

3590 Diepenbeek

BELGIUM

Tel. +32-11-26.91.26

Fax +32-11-26.91.99

E-mail: elke.moons@uhasselt.be 

  


	[[alternative HTML version deleted]]


