Learn R Programming

datazoom.amazonia (version 1.1.0)

read.dbc: Read Data Stored in DBC (Compressed DBF) Files

Description

This function allows you to read a DBC (compressed DBF) file into a data frame. 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

read.dbc(file, ...)

Value

A data.frame of the data from the DBC file.

Arguments

file

The name of the DBC file (including extension)

...

Further arguments to be passed to read.dbf

Author

Daniela Petruzalek, daniela.petruzalek@gmail.com

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). read.dbc relies on the dbc2dbf function to decompress the DBC into a temporary DBF file.

After decompressing, it reads the temporary DBF file into a data.frame using read.dbf from the foreign package.

See Also

dbc2dbf

Examples

Run this code
if (FALSE) {
# The 'sids.dbc' file is the compressed version of 'sids.dbf' from the "foreign" package.
x <- read.dbc(system.file("files/sids.dbc", package = "read.dbc"))
str(x)
summary(x)

# This is a small subset of U.S. NOAA storm database.
storm <- read.dbc(system.file("files/storm.dbc", package = "read.dbc"))
head(x)
str(x)

## Don't run!
## The following code will download data from the "Declarations of Death" database for
## the Brazilian state of Parana, year 2013. Source: DATASUS / Brazilian Ministry of Health
url <- "ftp://ftp.datasus.gov.br/dissemin/publicos/SIM/CID10/DORES/DOPR2013.dbc"
download.file(url, destfile = "DOPR2013.dbc")
dopr <- read.dbc("DOPR2013.dbc")
head(dopr)
str(dopr)
}

Run the code above in your browser using DataLab