title: Error opening SHP file in R using maptools readShapePoly
body: <p>I am new to R and was following the following tutorial on the ggplot2 package found <a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/james_cheshire_ggplot_intro_blog.pdf" rel="nofollow noreferrer">here</a>. However the readShapePoly() function throws an error whenever I try to load the basic shapefile. I have used the following code:</p>
  
  <pre><code>library("ggplot2")
  library("gpclib")
  library("maptools")
  setwd("~/Documents/R Projects/Intro to ggplot2") 
  #Intro to ggplot 2 contains the .shp file and associated data
  sport &lt;- readShapePoly("london_sport.shp")
  </code></pre>
  
  <p>which gets me:</p>
  
  <pre><code>Error in getinfo.shape(filen) : Error opening SHP file
  </code></pre>
  
  <p>I have tried omitting the file extension. I have also tried downloading other .shp files which throw the same error too. I have also tried calling readShapePoly using the full file path, which doesn't work either. I am using R studio (mac OSX), but I get the same error using the standard R window. I have tried the suggestions on the previous closed threat "Error opening SHP file in Rstudio", but to no avail.</p>
  
  <p><strong>Edit: the error was with a missing .dbf file. Thanks to @Spacedman for the fix.</strong></p>