Try

library(rgdal)
data.shape <- readOGR(dsn="C:/Users/study/Desktop", layer="data")

It's sort of confusing since shapefiles don't have layers, but GDAL allows
the dsn to be a folder of shapefiles, and to treat individual shapefiles as
layers within.

That makes it consistent with other vector formats that do have layers. See
?readOGR for examples.

Cheers, Mike




On Wednesday, December 5, 2012, Milan Sharma wrote:

>
>
> Dear all,
> I have a shape file in my desktop. I could not read this file in R. The
> following are my codes, can somebody tell me how to do? None of these are
> working..
> require(maptools)
> library(rgdal)
> ##my working directory is "C:/Users/study/Desktop".
> ##name of my shape file is data.
> shape <- readShapePoints("C:/Users/rasmit99/Desktop/data.shp")
> data.shape<-readOGR(dsn="data",layer="MyMap")
> data.shape<-readOGR(dsn="C:/Users/study/Desktop",layer="MyMap")
> states<-readOGR(dsn="C:/Users/study/Desktop",layer="counties")
> Thanks,
> Milan
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org <javascript:;>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>


-- 
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.com

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to