[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-geo
Subject:    Re: [R-sig-Geo] Error in spCbind(GA0, data) : row names not identical
From:       Bede-Fazekas_Ákos <bfalevlist () gmail ! com>
Date:       2017-10-23 7:50:24
Message-ID: c986242a-e155-05ad-433b-45c76d269831 () gmail ! com
[Download RAW message or body]

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]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic