Learn R Programming

DDIwR (version 0.18)

DDIwR_internal: DDIwR internal functions

Description

Functions to be used internally, only by developers and contributors.

ascii: Convert accented unicode characters to pure ascii

changeXMLang: Remove the xmlang attribute from all elements.

checkArgument: Check function arguments

checkDots: Check the three dots ... argument. If the argument is not supplied via dots, returns a default

checkElement: Check if an element is a DDI Codebook element

checkExisting: Check if a certain (sub)element exists in a DDI Codebook.

checkType: Determine the variable type: categorical, numerical or mixed

checkXMList: Determine if an XML list is a DDI Codebook

cleanup: Rectify texts read from a metadata object

coerceDDI: Recursive coerce an element to a DDI class

collectMetadata: Collect metadata from a file or a dataframe object

collectRMetadata: Collect metadata from a dataframe object

extractData: Extract data from an DDI Codebook XML document or list.

formatExample: Format an example from the DDI Codebook specification

generateID: Generate simple, custom unique ID codes

getDateTime: Current date and time

getDelimiter: Guess the column delimiter from a text file

getDNS: Extracts the Default Name Space from an XML object

getEnter: Get the carriage return code from the current Operating System

getFiles: Get information about the files in a given directory

getFormat: Determine the SPSS / Stata variable format

getHashes: Compute hashes of XML nodes

getValues: Extract values, labels and missing values from a var element

getXML: Read the DDI XML file, testing if it can be loaded.

hasLabels: Check if a dataset has (declared) labels

hasMissingLabels: Check if variables have missing labels

makeLabelled: Coerce variables to labelled objects

missingValuesSPSS: Prepares the missing values for the SPSS export syntax.

prespace: Prepend a text with a certain number of space characters.

removeExtra: Removes extra information from a DDI Codebook element

repeatSpace: Allows indentation of XML or HTML files

replaceChars: Replace certain characters, in preparation for XML export

replaceTicks: Recode all tick characters with a single quote.

splitrows: Split the written rows in the setup file.

treatPath: Determine which specific type of files are present in a certain directory.

writeMetadata: Utility function to write the metadata part in the setup file.

XMLtoRmetadata: Extract metadata from a single XML variable

writeRlist: Write an .R file containing a metadata specific list.

Usage

ascii(x)

changeXMLang(x, remove = FALSE)

checkArgument(argument, default, length = 1, ...)

checkDots(dotsvalue, default, length = 1)

checkElement(x)

checkExisting(xpath, inside, attribute = NULL)

checkType(x, labels = NULL, na_values = NULL, na_range = NULL)

checkXMList(xmlist)

cleanup(x, cdata = TRUE)

coerceDDI(element, name = NULL)

collectMetadata(dataset, ...)

collectRMetadata(dataset, ...)

extractData(xml)

formatExample(xml_node, level = 0, indent = 2)

generateID(x, nchars = 16)

getDateTime()

getDelimiter(x)

getDNS(xml)

getEnter(OS)

getFiles(path = ".", type = "*", currdir)

getFormat(x, type = c("SPSS", "Stata"), ...)

getHashes(nodes)

getValues(variable)

getXML(path, encoding = "UTF-8")

hasLabels(x)

hasMissingLabels(variables)

makeLabelled(x, variables, declared = TRUE)

missingValuesSPSS(variables, range = FALSE, numvars = TRUE)

prespace(text, indent = NULL)

removeExtra(element)

repeatSpace(times, indent)

replaceChars(x)

replaceTicks(x)

splitrows(x, enter, y = 80, spacerep = "")

treatPath(path, type = "*", single = FALSE, check = TRUE)

writeMetadata(variables, OS = "", indent = 4)

XMLtoRmetadata(xmlvar, dns)

makeNotes(data)

writeRlist(variables, OS = "windows", indent = 4, dirpath = "", filename = "")

Value

changeXMLang: A modified codeBook element.

checkElement: Boolean.

checkExisting: Boolean.

checkType: A character scalar

cleanup: A character vector

coerceDDI: A standard element of class DDI

collectMetadata: a standard DDI Codebook element dataDscr, containing variable level metadata information

collectRMetadata: an R list containing variable level metadata information

extractData: An R data frame, if existing, or NULL

generateID: Character vector

getDateTime: Character vector

getDelimiter: Character scalar

getDNS: Character scalar

getEnter: Character scalar

getFiles: A list with four components: the complete path, the files, the file names and the file extensions

getFormat: Character scalar

getHashes: Character vector

getValues: A list with two components: labels and na_values

getXML: An XML document

hasLabels: Boolean

hasMissingLabels: Boolean vector

makeLabelled: A modified data frame.

missingValuesSPSS: A vector of missing values representation.

prespace: A modified text.

removeExtra: A modified element.

repeatSpace: Character spaces

replaceChars: Character vector

replaceTicks: A recoded string.

splitrows: A character vector.

treatPath: A list with four components: the complete path, the files, the file names and the file extensions

XMLtoRmetadata: An R list containing metadata

Arguments

x

Number of ID values to return

nchars

Number of characters for each ID