[Rd] foreign::read.dbf fails to parse dbf properly

Ezra Tucker ezr@ @end|ng |rom |@ndtucker@com
Fri Jul 29 22:52:40 CEST 2022


Dear R developers,

tl;dr I've been trying to read foxpro dbf files with
foreign::read.dbf(), they weren't being read properly, I patched the
foreign package to make it work, now what?

Long version:
I recently encountered unexpected behavior attempting to read dbf files
using foreign::read.dbf() from here:

https://forms.ferc.gov/f1allyears/f1_2020.zip

unzipped, in UPLOADERS/FORM1/working/F1_15.DBF - and as a note, this is
a foxpro database. I would expect the first row of the first column to
be 40, instead I am getting "(" (realizing that "(" has a decimal ascii
value of 40). The xbase docs indicate that this is a field of type "I"
which is a 4-byte integer unique to foxpro, and it doesn't look like
this case is contemplated by read.dbf()

I made some modifications to Rdbfread.c and dbfopen.c in the foreign
package (version 0.8-82) to add specific handling for field type "I".

I'm not current set up to contribute directly, I don't have SVN access.

1. Is this patch of general interest? I'm weighing in the development
guidelines:
  - DO NOT fix exotic bugs that haven't bugged anyone
  - DO make small enhancements if they are badly needed
and I feel like this is maybe a bit of an exotic lack-of-feature
(wouldn't call it a bug), and I have no idea if this is badly needed
(by anybody, other than myself)

2. if of general interest, how can I get set up with SVN credentials
for R-packages?

Thanks!
-Ezra



More information about the R-devel mailing list