I am using the dismo package in R and performing a species distribution model. There are a few points that are in the wrong location that I would like to remove. I used the identify tool which tells me the number of the point in the occurrence data, but I'm not sure what code to use to delete these points. One of the points I want to remove is 302339 for example.
sparrow= gbif("ammodramus", "maritimus*", geo=FALSE)
sparrow
names(sparrow)
dim(sparrow)
sparrow <- subset(sparrow, !is.na(lon) & !is.na(lat))
library(maptools)
data(wrld_simpl)
plot(wrld_simpl, xlim=c(-40,-10), ylim=c(20,100), axes=TRUE, col="light yellow")
points(sparrow$lon, sparrow$lat, col="orange", pch=20, cex=0.75)
points(sparrow$lon, sparrow$lat, col="red", cex=0.75)
identify(sparrow$lon, sparrow$lat)
sparrow[ 302339, 'lat'] <- NA
. Generally graphics functions just ignore items with coordinates that are NA. I don't suppose you could find a location with fewer sparrows? That example takes a longggggg time to load. - IRTFMsparrow[ 30439, 'lat']
, you get[1] 57.2833
, which is clearly the outlier in the plot that (eventually) appeared. When I followed my own advice that point (off the Newfoundland coast) disappears when plotting is repeated. - IRTFM