[R-sig-Geo] Error in spCbind(GA0, data) : row names not identical

Bede-Fazekas Ákos bfalevlist at gmail.com
Mon Oct 23 09:50:24 CEST 2017


Hi Marvin,

I think it should be better to post more information on the error, which 
could help us to help you. And while you try to get these additional 
infos, you might find the solution to your problem. I think, running
row.names(GA0)
row.names(data)
all.equal(row.names(GA0), row.names(data))
row.names(GA0)[row.names(GA0) != row.names(data)]
row.names(data)[row.names(GA0) != row.names(data)]
may help you to start searching the cause of the error. (Which is simply 
connected to the spelling of "De Kalb", and has nothing to do with 
spatial data and R...)
 > row.names(GA0)[row.names(GA0) != row.names(data)]
[1] "de kalb" "decatur"
 > row.names(data)[row.names(GA0) != row.names(data)]
[1] "decatur" "dekalb"

Have a nice day,
Ákos


2017.10.22. 14:48 keltezéssel, Marvin Sharma írta:
> HI,
> Could some one help  this newbie in fixing the spCbind problem 
> encountered below?
> >names(data)
>  "county"    "y"        "x"         "Latitude"  "Longitude"
>
> GA <- map("county", "georgia", plot=FALSE, fill=TRUE)
> cntys <- tolower(as.character(data$county))
> GA$names <- substring(GA$names, 9, nchar(GA$names))
> match(cntys, GA$names)##It does  match!
> #######################################
> GA <- map2SpatialPolygons(GA, GA$names)
> proj4string(GA) <- CRS("+proj=longlat")
> row.names(data) <- cntys
> GA0 <- SpatialPolygonsDataFrame(GA, 
> data=data.frame(ID=1:159,row.names=row.names(GA)))
> GA1 <- spCbind(GA0, data)
> > GA1 <- spCbind(GA0, data)
> Error in spCbind(GA0, data) : row names not identical
> >
> Thanks n advance,
>
> Marvin


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list