Hey all,

I'm trying to merge a data frame with a shapefile and view it in ArcGIS, but
I keep getting the following error message:
" in Math.data.frame(list(X = c(1L, 2L, 5L, 7L, 10L, 11L, 8L, 6L,
: non-numeric variable in data frame: XY"

"data": looks something like this:
Id (integer), X (factor), Y (factor), LocationId (factor), MUSYM (factor),
SoilName (factor), Elevation (numeric), SlopePerce (numeric), Aspect
(numeric), SoilPh (numeric), coords.x1 (numeric), coords.x2 (numeric)

"data.to.merge": looks something like this, all with numeric class except
"Location":
Spp.Rich, Spp.Rich.Prop, Spp.Pairs, Spp.Pairs.Prop, Location (factor)

In R:

library(spatstat)
library(maptools)
# In ArcCatalog, I first exported my feature class to a single shapefile
data<-readShapeSpatial("data.shp")
merged.data <-merge(data,data.to.merge,by.x="Id",y="Location",sort=T)
#Merging the data frames and throwing out the NA's
head(merged.data, n=3)

  Id                X                Y    LocationID
MUSYM                                         SoilName Elevation_
SlopePerce  Aspect SoilPh coords.x1
1  7 713967.781188522 4876995.49996724 PIPE_VegMon_7  J86B     Vienna silty
clay laom 3 to 6 percent slopes    506.847    1.01266 26.9994      0
713967.8
2  8 713986.874948539 4877174.25004741 PIPE_VegMon_8  J71A  Brookings silty
clay laom 1 to 3 percent slopes    503.881    2.16179 25.7172      0
713986.9
3  9 714118.562500662  4877165.2499834 PIPE_VegMon_9  P18B Ihlen-Rock
outcrop complex 0 to 6 percent slopes    503.310    3.69292 20.5218      0
714118.6
  coords.x2 Spp.Rich Spp.Rich.Prop Spp.Pairs Spp.Pairs.Prop
1   4876995       70     0.4191617      2415   3.024036e-05
2   4877174       82     0.4910180      3321   3.542443e-05
3   4877165       81     0.4850299      3240   3.499242e-05


a<-merged.data[,1:3]
b<-merged.data[,c(1,4:16)]
shapefile<-convert.to.shapefile(a,b,field="Id",1) # When I run this command,
I end up getting an error message.

I'm completely stumped.  Any suggestions?

Thanks in advance,

--
Lanna Jin

lannajin@gmail.com
510-898-8525

	[[alternative HTML version deleted]]

