Hello everybody,
I am trying to convert some spatial points (given a value of latitude and a value of longitude) to a neighbour list in R. I need this in order to perform a linear regression with a spatial autocorrelation.
I have a list of individual animal species occurrences worldwide, each one with a single value of latitude and longitude. I would need to create an object class nb (neighbour list), but I do not know how to do this conversion in R.
My data looks like:
SPECIES: LATITUDE, LONGITUDE species A: -85, 134 species B: 34 , 2 species B: 42, 3 species B: 45, 5 species C: -2, 80 species C: -5, 79 (...)
The dataset also contains other columns with the values of certain variables, but I think this is not important for my purpose.
Any help will be appreciated. Thank you in advance
EDIT:
I am using the package "spdep". First of all, I converted my data frame to a spatial object:
coordinates(dataset)