I am new to R and am having trouble plotting a SpatialPointsDataFrame, with eventual hopes of creating minimum convex polygons. I've been trying for a few days but can't find anything to fix this problem.
I load my excel data as TXT. File has 3 columns (Latitude, Longitude, ID) and 549 rows of observations. Then I enter the following code:
# Create coordinates variable
coords <- cbind(LAT = as.numeric(as.character(multi$LAT)), LONG = as.numeric(as.character(multi$LONG)))
# Create the SpatialPointsDataFrame
multi_SPDF <- SpatialPointsDataFrame(coords, data = data.frame(multi$ID), proj4string = CRS("+init=epsg:4326"))
#Plot the points
plot(multi_SPDF)
When I enter this, it produces a plot that looks like this:
I made this code from a similar code found at this link: http://www.alex-singleton.com/R-Tutorial-Materials/7-converting-coordinates.pdf
If anyone is able to help me to make this work I would really appreciate it. Hopefully I provided all of the necessary information.
EDIT
In an attempt to provide a reproducible example, I extracted the head of the data to copy into the comment, as follows:
LAT LONG ID
1 -41.30853 174.7342 7
2 -41.30481 174.7353 6
3 -41.30681 174.7363 7
4 -41.30660 174.7360 10
5 -41.31400 174.7329 10
6 -41.31059 174.7350 6
When I ran the above code on these 6 rows alone, it produced a plot with points distributed vertically and horizontally (exactly what I wanted!)
However, the same code still does not work on my entire data set. So I think the problem may be in my excel file and not my code.