[R-sig-Geo] Converting csv files to SpatialPolygonsDataFrame

Ahmed Najar najar at ualberta.ca
Wed Sep 28 21:07:19 CEST 2016


I was trying to convert a csv file to SpatialPolygonsDataFrame and I was
encountering several problems. Would you have any case study that I could
follow.

I used this script and keep getting the following error

> AB <- read.csv("map_AB.csv")> AB=na.omit(AB)> X = SpatialPolygonsDataFrame(AB[,1:2], data = AB)Error in SpatialPolygonsDataFrame(AB[, 1:2], data = AB) :
  trying to get slot "polygons" from an object (class "data.frame")
that is not an S4 object



Most grateful for any help.

Cheers,

Ahmed

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list