[GRASS-stats] readVECT6 problem fo importing null data

Jarek Jasiewicz jarekj at amu.edu.pl
Mon Nov 26 13:17:33 EST 2007


Dear Collages!

I found some Issue (seems problematic) with readVECT6 (there are all 
commands I used, complete my answer)

I have vector file attached table (pgSQL) with null values both for int4 
and char columns (example table):
I import the table via RdbiPgSQL

 >library(RdbiPgSQL)
 >conn=dbConnect(PgSQL(), host="localhost", ........)
 >sql="SELECT * FROM t"
 >quer=dbSendQuery(conn, sql)
 >table=dbGetResult(quer)
 >table
  cat int4 char
1   2     1   <NA>
2   4    NA   <NA>
3   6     5   <NA>
4   7    NA   <NA>
5   1     0      n
6   3    NA      b
7   5     4      p
8   8     6      c

As you see, there are two columns int4 and char with null values, which 
are imported to R as shoud be.

But what happend if we import data b y readVECT6:

 > readVECT6("t")
Exporting 8 points/lines...
 100%
8 features written
OGR data source with driver: ESRI Shapefile
Source: "/home/jarekj/grassdata/azp/PERMANENT/.tmp/jarekj-desktop", 
layer: "t"
with  8  rows and  3  columns
         coordinates         cat int4 char
1 (3688170, 5673160)   1     0      n
2 (3694430, 5674130)   2     1      
3 (3701530, 5665800)   3     0      b
4 (3690110, 5660580)   4     0      
5 (3706040, 5668900)   5     4      p
6 (3693660, 5665800)   6     5      
7 (3704170, 5674130)   7     0      
8 (3705460, 5660450)   8     6      c

null values for char are preserved but for int, has been changed to 0.

AFAIK, it is due to v.out.ogr use shapefile and dbf which  treat null in 
integer as 0 during export.

So, it is a problem??? Or May I forgot do something.
best regards
Jarek



More information about the grass-stats mailing list