Here is my problem in R:
> readOGR(dsn="C:/Users/abc/desktop/shapfile","SD06") 
OGR data source with driver: ESRI Shapefile 
Source: "C:/Users/abc/desktop/shapfile", layer: "SD06"
with 66 features and 36 fields
Feature type: wkbPolygon with 2 dimensions
 #Is the above program running correctly? Or, is this indicating some problem in data?
> names(data)
 [1] "STATEFP"    "COUNTYFP"   "COUNTYNS"   "GEOID"      "NAME"      
 [6] "NAMELSAD"   "LSAD"       "CLASSFP"    "MTFCC"      "CSAFP"     
[11] "CBSAFP"     "METDIVFP"   "FUNCSTAT"   "ALAND"      "AWATER"    
[16] "INTPTLAT"   "INTPTLON"   "SD06_csv_C" "SD06_csv_O" "SD06_csv_D"
[21] "SD06_csv_1" "SD06_csv_2" "SD06_csv_3" "SD06_csv_B" "SD06_csv_4"
[26] "SD06_csv_E" "SD06_csv_M" "SD06_csv_S" "SD06_csv_G" "SD06_csv_5"
[31] "SD06_csv_6" "SD06_csv_W" "SD06_csv_H" "SD06_csv_p" "SD06_csv_A"
[36] "SD06_csv_7"
> #in my shape file, column names have come 
> #SD_csv_O,  SD_CSV_D,instead of open water, 
> #or other names like that because of my problem in creating shape file.
> # I wanted to assign the correct names of my columns using names (data). But got error
> colnames(data) <- c( "STATEFP","COUNTYFP","COUNTYNS" ,  "GEOID", "NAME","NAMELSAD","LSAD","CLASSFP","MTFCC","CSAFP","CBSAFP","METDIVFP","FUNCSTAT","ALAND","AWATER","INTPTLAT","INTPTLON", "Openwater","Dev open","DevLowin","DevMed","DevHi","Barren","Deciduous","Evergr","Mixfor","Shrub","Grass","Sedge","Cultcrop","Woody","wetHerb","p2010","Areasqml","Popsqm")
Error in `colnames<-`(`*tmp*`, value = c("STATEFP", "COUNTYFP", "COUNTYNS",  : 
  'dimnames' applied to non-array
> dim(data)
[1] 66 36
> #Any help is appreciated.
Milan
 

________________________________
 From: Barry Rowlingson <b.rowlingson@lancaster.ac.uk>

Cc: "r-sig-geo@r-project.org" <r-sig-geo@r-project.org> 
Sent: Wednesday, January 30, 2013 2:24 AM
Subject: Re: [R-sig-Geo] Shape file problem
  
What are the correct names? "01", "02" and so on? Or were you
expecting something else? We don't have your data so we have no idea
what the right answer is.

How did you create your shapefile? In R? You don't say.

Please show is the code you used, or a simple example that illustrates
the problem. It might be something to with R not liking column names
to be numeric. I tried a little test just now, and saving an
SpatialPointsDataFrame with numeric column names produces a warning,
and reading a shapefile with numeric column names converted the names
to "X01" and "X02".

But I'm wasting my time if this isn't your problem, and you haven't
really told us enough.






rote:
> Dear all,
> my question is about shapefile and GIS, rather than R. If somebody could kindly help me, or can direct me to another site, I would appreciate that.
> I created my shapefile successfully, and the name of my shapefile is AZ. I have different name for the columns of my shape file, but shape file assigns the names of my columns as "AZ_01", ",....AZ_02",.., and so on. How can I get correct names correctly in my shapefile?
>
> Thanks,
> Milan
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
	[[alternative HTML version deleted]]

