This function extracts the metadata from an R dataset, or alternatively it
can read an XML file containing a DDI Codebook version 1.2.2, 2.5 or 2.6, or an
SPSS or Stata file and returns a list containing the variable labels, value
labels and information about the missing values.
If the input is a dataset, it will extract the variable level metadata
(labels, missing values etc.). From a DDI XML file, it will import all
metadata elements, the most expensive being the data description.
It additionally attempts to automatically detect a type for each variable:
cat: | categorical variable using numeric values |
catchar: | categorical variable using character values |
catnum: | categorical variable for which numerical summaries |
| can be calculated (ex. a 0...10 Likert response scale) |
num: | numerical |
numcat: | numerical variable with few enough values (ex. number of
children) |
| for which a table of frequencies is possible in addition to
frequencies |
Apart from utf8, other encodings might be necessary when reading from
SPSS or DDI XML files, for instance latin1 or windows-1252, and it also
accepts bytes for multi-byte encodings. To use the one specified in the
file, set encoding = NULL. The default is encoding = "auto", which tries to
detect the encoding automatically.
For the moment, only DDI Codebook is supported, but DDI Lifecycle is planned
to be implemented.