Rev 649 | Rev 3173 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{read.dbf}\alias{read.dbf}\title{Read a DBF File}\description{The function reads a DBF file into a data frame, converting characterfields to factors, and trying to respect NULL fields.}\usage{read.dbf(file, as.is = FALSE)}\arguments{\item{file}{name of input file}\item{as.is}{should character vectors not be converted to factors?}}\details{DBF is the extension used for files written for the \sQuote{XBASE}family of database languages, \sQuote{covering the dBase, Clipper,FoxPro, and their Windows equivalents Visual dBase, Visual Objects,and Visual FoxPro, plus some older products}(\url{http://www.e-bachmann.dk/docs/xbase.htm}). Most of these followthe file structure used by Ashton-Tate's dBase II, III or 4 (laterowned by Borland).\code{read.dbf} is based on C code from\url{http://shapelib.maptools.org/} which implements the\sQuote{XBASE} specification. It can convert fields of type\code{"L"} (logical), \code{"N"} and \code{"F"} (numeric and float)and \code{"D"} (dates): all other field types are read as-is ascharacter vectors. A numeric field are read as an \R integer vector ifit is encoded to have no decimals, otherwise as a numeric vector.}\value{A data frame of data from the DBF file; note that the field names areadjusted to use in R using \code{\link{make.names}(unique=TRUE)}.There is an attribute \code{"data_type"} giving the single-characterdBase types for each field.}\references{\url{http://shapelib.maptools.org/}.The Borland file specification \emph{via}\url{http://www.wotsit.org/search.asp?s=database}.}\author{Nicholas Lewin-Koh and Roger Bivand; shapelib by Frank Warmerdam}\seealso{\code{\link{write.dbf}}}\examples{x <- read.dbf(system.file("files/sids.dbf", package="foreign")[1])str(x)summary(x)}\keyword{file}