wh_dict: Create Data Dictionary from Data Warehouse

Description Usage Arguments Value Warning See Also Examples

Description

Stacks part of a data frame and repeat the other columns to fit the result of stacking. Optionally records the result into a log file.

Usage

1
wh_dict(x, attr, value)

Arguments

x

The data frame

attr

The index of the column in x to be explained.

value

The index of the column in x as the explanation in the Keys column of the dictionary.

Value

A 2-column data frame, in which the Keys column stores the explanation of the values in x[, attr].

Warning

x can only be a data frame. Don't pass a vector to it.

See Also

inspect_map, encode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# refer to vignettes if you want to use log files
message('refer to vignettes if you want to use log files')

# building a data frame
A <- c('i', 'j', 'i', 'k', 'j')
B <- as.factor(c('x', 'y', 'x', 'z', 'y'))
C <- 1:5
df <- data.frame(A, B, C)
print(df)

# encoding
dict <- wh_dict(df, attr = 'B', value = 'A')
print(dict)

sherrisherry/cleandata documentation built on May 7, 2019, 5:02 a.m.