dbc2dbf: Decompress a DBC (compressed DBF) file

View source: R/dbc2dbf.R

dbc2dbfR Documentation

Decompress a DBC (compressed DBF) file

Description

This function allows you decompress a DBC file into its DBF counterpart. Please note that this is the file format used by the Brazilian Ministry of Health (DATASUS), and it is not related to the FoxPro or CANdb DBC file formats.

Usage

dbc2dbf(input.file, output.file)

Arguments

input.file

The name of the DBC file (including extension)

output.file

The output file name (including extension)

Details

DBC is the extension for compressed DBF files (from the 'XBASE' family of databases). This is a proprietary file format used by the brazilian government to make available public healthcare datasets (by it's agency called DATASUS).

It uses internally the PKWare's Data Compression Library (DCL) "implode" compression algorithm. When decompressed, it becomes a regular DBF file.

Value

Return TRUE if succeded, FALSE otherwise.

Author(s)

Daniela Petruzalek, daniela.petruzalek@gmail.com

Source

The internal C code for dbc2dbf is based on blast decompressor and blast-dbf (see References).

References

The PKWare ZIP file format documentation (contains the "implode" algorithm specification) available at https://support.pkware.com/display/PKZIP/APPNOTE, current version https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT.

blast source code in C: https://github.com/madler/zlib/tree/master/contrib/blast

blast-dbf, DBC to DBF command-line decompression tool: https://github.com/eaglebh/blast-dbf

See Also

read.dbc

Examples

# Input file name
in.f  <- system.file("files/sids.dbc", package = "read.dbc")

# Output file name
out.f <- tempfile(fileext = ".dbc")

# The call return logi = TRUE on success
if( dbc2dbf(input.file = in.f, output.file = out.f) ) {
     print("File decompressed!")
     file.remove(out.f) # clean up example, don't do in real life :)
}


read.dbc documentation built on July 9, 2023, 7:03 p.m.