Bug 17239 - Improve Handling of Integer and Floating Point Values in Exported DBFs
Summary: Improve Handling of Integer and Floating Point Values in Exported DBFs
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Add-ons (show other bugs)
Version: R 3.3.*
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2017-03-17 15:10 UTC by Marcelo Simas
Modified: 2017-04-19 16:18 UTC (History)
1 user (show)

See Also:


Attachments
Patch file for improving identification of int and precision of float numbers in DBF files (foreign package) (1.69 KB, patch)
2017-03-17 15:10 UTC, Marcelo Simas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Simas 2017-03-17 15:10:51 UTC
Created attachment 2239 [details]
Patch file for improving identification of int and precision of float numbers in DBF files (foreign package)

We were trying to use R to automate the generation of deliverable DBF files as part of a transportation project for Michigan DOT and Detroit's MPO (SEMCOG) and realized that the resulting files did not generate integer and floating point column specs in the DBF header in a way that was consistent with the underlying data.  The main issues we saw, and that became sticking points for the client, were:

 - Some of the integer variables were exported as floating point numbers
 - The number of decimal places in the exported files was fixed and did not reflect the number of decimal places in the data

To address these issues, we made changes to the dbf.R file in the foreign package that improve the identification of integer data and explicitly compute and specify the precision of floating point data in the generated DBF file header.  

We believe that these changes increase the fidelity of DBF files generated by R and would like to see them included in future updates.

We have attached a patch file for this change.
Comment 1 Marcelo Simas 2017-04-18 16:01:04 UTC
Bump
Comment 2 Duncan Murdoch 2017-04-18 23:10:35 UTC
"Bump"ing a report isn't going to make a difference.  If nobody replied to your original report, it's likely that nobody is currently interested in supporting that aspect of the package.  (I don't even know what a DBF file is.  It might help to explain what it is, and why it's important.)  

You could also try to figure out who committed the original dbf.R file, and ask them to deal with your issue.  But they might not be interested in supporting it any longer, so the solution might be to remove dbf.R.  The source repository is at <https://svn.r-project.org/R-packages/trunk/foreign>.
Comment 3 Marcelo Simas 2017-04-19 16:18:53 UTC
Sorry, did not want to ruffle feathers but felt like a month was a long time for a bug to get no comments/updates.

My report includes a patch that addresses the issue and has improved the resulting DBF file.  R is quickly becoming a popular tool for transportation planners and modelers (both in consulting and government) and several tools used in this area rely on DBF files to store tabular data.  Removing support for DBF files would impact the ability of R to interact with these types of tools.

I reported this here b/c the foreign package reports that it is maintained by the core team, but I will follow your suggestion and attempt to contact the original package committers. 

Thank you, M