[R] Unexpected result of read.dbf

From: Susumu Tanimura <stanimura-ngs_at_umin.ac.jp>
Date: Thu 18 Aug 2005 - 16:04:46 EST


Hi there,

Unexpected result is given with read.dbf from foreign 0.8-9, which is reproducible in R 2.1.1 with the following sample data:

In the example, the name of column is "KEYCODE" with numeric type, 19 digits, and no decimal.

The data was saved as CSV format for confirmation.

> dbf.test <- read.dbf("test.dbf")
> dbf.test[1:20,]

 [1] 422010010        NA        NA        NA        NA 422010060 422010071
 [8] 422010072        NA        NA 422010100        NA        NA 422010130
[15] 422010140        NA        NA        NA 422010180 422010190

> csv.test <- read.csv("test.csv")
> csv.test[1:20,]
 [1]   422010010 42201002101 42201002102 42201002103 42201002104   422010060
 [7]   422010071   422010072 42201008001 42201008002   422010100 42201011001
[13] 42201011002   422010130   422010140 42201015001 42201015002 42201015003
[19]   422010180   422010190

I wonder why I get NA from test.dbf. I have this kind of trouble when handling ESRI Shape files with maptools. There is no choice to use read.csv instead of read.dbf at executing read.shape.

--
Susumu Tanimura

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Aug 18 16:11:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:51 EST