Roland, James, Roger and Carson

ogrInfo() provides info consistent with the behaviour of readOGR()
and editing the dbf with OO as suggested by Roland reveals
that the field is labeled as "C,80" (which I do not understand
as values are areas written by fTools in QGIS, Carson, could this be
a bug?)
Substitution of "C,80" by "N,15,3" in the dbf file for that field with OO
does not work (all values imported as 0). I think that this is because
all values for that field in the dbf have a "'" which is what makes
the field to be character and which I had overlooked. I've tried replacing all "'" for that field in OO but, oddly, OO claims that
that no "'" are present.

Anyway, the problem is clearly in the dbf file and not in rgdal.

Also, the quick fix suggested by James works fine.

Thank you all.

Agus

Roger Bivand wrote:
On Fri, 5 Dec 2008, James Nylen wrote:

This happens to me as well.  I just create a new column in the shapefile
object's data, like:

shp$AreaNum = as.numeric(as.vector(shp$AREA))

If all you want to know is "why is it coded this way" then I have no idea,
sorry.

You could look at ogrInfo() for the same dsn= and layer= before you import. In principle, if the driver reports "Integer", "Real", or "String", this should be respected, so I'd be interested in seeing a case.

Roger


-James

On Fri, Dec 5, 2008 at 10:29 AM, Agustin Lobo <[EMAIL PROTECTED]> wrote:

I often get some numeric fields (i.e, AREA in this case) imported
as factors by readOGR() from shp files. WHy could it be?
I've reviewed the field in the dbf file and do not
see any non-numeric value.

Thanks
Agus
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


    [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to