Converting csv files to SpatialPolygonsDataFrame
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