Description Usage Arguments Examples
View source: R/DataDictionary.R
This function creates a .txt data dictionary from a dataframe, list of variable labels, and list of value labels. If no variable or value label lists are specified, it assumes these are found in attr(x, "variable.labels") and attr(x, "value.labels"), respectively. It writes variable and value label metadata to a .txt data dictionary file that can function as a codebook. Optionally, you can choose to include summary information from each variable in the data dictionary file with "include.summary=TRUE".
1 2 3 | DataDictionary(x, variable_labels = attr(x, "variable.labels"),
value_labels = attr(x, "value.labels"), include.summary = FALSE,
file = "DataDictionary.txt")
|
x |
A dataframe |
variable_labels |
A vector or list of variable labels. Should be the same length as ncol(x) and the labels should appear in the same order. Defaults to "variable.labels" attribute of x. |
value_labels |
A list of value labels. Defaults to "value.labels" attribute of x. |
include.summary |
Logical. Should a summary of the each variable (output of summary()) be included in the data dictionary? Defaults to FALSE. |
file |
The file name and location to which the data dictionary should be written. Defaults to "DataDictionary.txt" in the current working directory. |
1 2 | iris #Create a data dictionary for iris dataset; varlab = c("Length of Sepal in centimeters", "Width of Sepal in centimeters", "Length of petal in centimeters", "Width of Petal in centimeters", "Species of iris"); vallab = c(rep("", ncol(iris))); DataDictionary(iris, variable_labels = varlab, value_labels=vallab, include.summary = TRUE)
DataDictionary()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.