title: How to convert csv to shp in R
body: <p>I have been trying for the past couple of days to convert a csv to shapefile. I know I can easily do in QGIS or Arc but would like to add this process into my existing R code.</p>
  
  <p>So i can read in the csv with no issues</p>
  
  <pre><code>MyData &lt;- read.csv(file="c:/TheDataIWantToReadIn.csv", header=TRUE, sep=",")
  </code></pre>
  
  <p>I found the code below from the Packages Shapefile help guide. However I can't seem to find a way for it to work on my code. My rows are each a point, therefore my shapefile I am trying to create will be all points. I don't have an Id column, however I do have x and y data in two separate columns. </p>
  
  <pre><code>dd &lt;- data.frame(Id=c(1,2),X=c(3,5),Y=c(9,6))
  ddTable &lt;- data.frame(Id=c(1,2),Name=c("Item1","Item2"))
  ddShapefile &lt;- convert.to.shapefile(dd, ddTable, "Id", 1)
  write.shapefile(ddShapefile, "c:/test", arcgis=T)
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>