[R] Error opening SHP file (maptools)

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 12 14:28:04 CET 2008


Don MacQueen <macq <at> llnl.gov> writes:

> 
> The help page for readShapePoints says that the file name that you 
> supply should not include the extension.
> 
> The "system.file" part of the example in the help page is only to use 
> the example file that came with the package. Since you want to open 
> your own file you omit the system.file() bit.
> 
> Do something like:
> 
>     readShapePoints( 'C:/path_to_my_file/filename')

You may also - for safety's sake - say:

list.files(path="C:/path_to_my_file", pattern="filename")

to make sure that at least the minimum three files that make up a 
"shapefile" are present: filename.dbf, filename.shp, and filename.shx. 
Note that in Windows you can also use the file chooser, by saying:

readShapePoints(file.choose())

which will let you navigate to, and "see" the file name for yourself.

Roger

PS. As Paul mentioned, the R-sig-geo list is well suited to this 
kind of question.



> 
> Hope this helps.
> -Don
> 
>



More information about the R-help mailing list