[R] maptools no such file

Roger Bivand Roger.Bivand at nhh.no
Mon Jan 28 13:19:53 CET 2008


Roger Bivand <Roger.Bivand <at> nhh.no> writes:

> 
>  <pieterprovoost <at> gmail.com> writes:
> 
> > 
> > No, I get the same error message there...
> 
> Your original question was:
> 
> "I'm having problems reading a shapefile with read.shape (maptools). I'm
> absolutely sure my file is there, but I get "no such file". The wd is ok,
> since read.table for example does find the file.
> 
> > getwd()
> [1] "D:/somedirectory/R scripts"
> > read.table("cities.shp")
> 
> which is self-explanatory, because you were not using read.shape() anyway.

OK - this was your test that the file existed. read.dbf("cities.dbf") might 
have been more helpful.


To check that there is no "spaces in path names" problem here, I tried:

> library(maptools)
> getwd()
[1] "/home/rsb/tmp/bigshape/R scripts"
> list.files(pattern="shp$")
[1] "co37_d90.shp"
> getinfo.shape("co37_d90.shp")
Shapefile type: Polygon, (5), # of Shapes: 104
> shp <- read.shape("co37_d90.shp")
Shapefile type: Polygon, (5), # of Shapes: 104

admittedly on Linux and with an up-to-date package. I have also checked on
Windows XP, also with current maptools and R 2.6.1, with the same result. Seeing
your sessionInfo() would show both your platform and package version.

Roger

> If you want to, you can use file.choose() to choose the file interactively.
> 
> If you haven't solved this yourself by then (found the files youself), do
> remember to include the verbatim output of sessionInfo() too.
> 
> Roger Bivand
> 
> > 
> > --
> > This message was sent on behalf of pieterprovoost <at> gmail.com at
> openSubscriber.com
> > http://www.opensubscriber.com/message/r-help <at> r-project.org/8476734.html
> > 
> 
> ______________________________________________
> R-help <at> r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
>



More information about the R-help mailing list