read.dbf               package:foreign               R Documentation

_R_e_a_d _a _D_B_F _F_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     The function reads a DBF file into a data frame, converting
     character fields to factors, and trying to respect NULL fields.

_U_s_a_g_e:

     read.dbf(file, as.is = FALSE)

_A_r_g_u_m_e_n_t_s:

    file: name of input file

   as.is: should character vectors not be converted to factors?

_D_e_t_a_i_l_s:

     DBF is the extension used for files written for the 'XBASE' family
     of database languages, '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 follow
     the file structure used by Ashton-Tate's dBase II, III or 4 (later
     owned by Borland).

     'read.dbf' is based on C code from <URL:
     http://shapelib.maptools.org/> which implements the 'XBASE'
     specification.  It can convert fields of type '"L"' (logical),
     '"N"' and '"F"' (numeric and float) and '"D"' (dates): all other
     field types are read as-is as character vectors.  A numeric field
     are read as an R integer vector if it is encoded to have no
     decimals, otherwise as a numeric vector.

_V_a_l_u_e:

     A data frame of data from the DBF file; note that the field names
     are adjusted to use in R using 'make.names(unique=TRUE)'.

     There is an attribute '"data_type"' giving the single-character
     dBase types for each field.

_A_u_t_h_o_r(_s):

     Nicholas Lewin-Koh and Roger Bivand; shapelib by Frank Warmerdam

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://shapelib.maptools.org/>.

     The Borland file specification _via_ <URL:
     http://www.wotsit.org/search.asp?s=database>.

_S_e_e _A_l_s_o:

     'write.dbf'

_E_x_a_m_p_l_e_s:

     x <- read.dbf(system.file("files/sids.dbf", package="foreign")[1])
     str(x)
     summary(x)

