[R-sig-Geo] knearneigh: data non-numeric

Andreas Forø Tollefsen andreasft at gmail.com
Fri Sep 12 09:35:29 CEST 2014


Hi all,

I have never experienced this issue before, but I assume there is something
in my spatialpolygondataframe causing this.
Whenever I try to create a knn object using these data, I get the error
"knearneigh: data non-numeric".

The code used:
knearneigh(gadmsimpl4_poly,k = 4,longlat = FALSE)
Error in knearneigh(gadmsimpl4_poly, k = 4, longlat = FALSE) :
knearneigh: data non-numeric

Any ideas what might be causing this error? I cannot remember seeing this
before.

Andreas

Metadata:
> class(gadmsimpl3_poly)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
> length(colnames(gadmsimpl3_poly at data))
[1] 84
> length(gadmsimpl3_poly)
[1] 1095
> gadmsimpl3_poly at bbox
        min      max
x -25.36181 50.48654
y -34.63487 25.00001
> gadmsimpl3_poly at proj4string
CRS arguments:
 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list