This question already has an answer here:

How can I read ESRI polygon/polyline shapefile in R environment using rgdal or other library? can I get a syntax for it?

marked as duplicate by Simbamangu, BERA, Evil Genius, ArMoraer, whyzar Jul 3 at 13:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    This link might help as it mentions how to do it using rgdal: – Joseph Oct 13 '14 at 13:00
  • 2
    In the future, please make some effort to search the site. This is addressed in many posts. That said, look at "readOGR" for vector and "readGDAL" for rasters using the rgdal package. The help documents are very clear with specific examples for shapefiles. The preferred alternative for rasters are "raster", "stack" or "brick" in the raster packages. There are also options using the maptools package but they do not retain projection information. One advantage of rgdal is that you have access to several additional functions associated with GDAL. – Jeffrey Evans Oct 13 '14 at 15:48

Possible duplicate with How to open a Shapefile in R?

There are many packages to read shapefiles:

readShapeSpatial in the maptools package is my go-to function:


Nice tutorial here:

As previously stated, a really useful function is readOGR from the package rgdal, but also fortify from ggplot2, which transforms the object SpatialPolygonsDataFrame (difficult to work with!) into an R-friendly one.

A good tutorial can be found here.

  • This is not correct! The readOGR is what creates the sp SpatialPolygonsDataFrame object, not fortify. The fortify function, which is now depreciated in leu of broom and tidy, is just a method for converting an sp object to something that ggplot2 can handle. I have no idea what R friendly is supposed to mean. An S4 class is quite R like and objects resulting from fortify are not suitable for subsequent spatial analysis using the array of supporting spatial R packages. – Jeffrey Evans Dec 30 '17 at 2:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.