readMicrodata function

readMicrodata

readMicrodata

reads data from various formats into R. Used in sdcApp.

readMicrodata( path, type, convertCharToFac = TRUE, drop_all_missings = TRUE, ... )

Arguments

  • path: a file path

  • type: which format does the file have. currently allowed values are

    • sas
    • spss
    • stata
    • R
    • rdf
    • csv
  • convertCharToFac: (logical) if TRUE, all character vectors are automatically converted to factors

  • drop_all_missings: (logical) if TRUE, all variables that contain NA-values only will be dropped

  • ...: additional parameters. Currently used only if type='csv' to pass arguments to read.table().

Returns

a data.frame or an object of class 'simple.error'. If a stata file was read in, the resulting data.frame

has an additional attribute lab in which variable and value labels are stored.

Note

if type is either 'sas', 'spss' or 'stata', values read in as NaN

will be converted to NA.

Author(s)

Bernhard Meindl