Description Usage Arguments Value Examples
add a label as attribute (var_label) to each column of data.frame based on dictionnary. This label will be used during the reporting function.
1 | setLabelToVariable(data, varLabel, varIndex = 1, labelIndex = 2)
|
data |
the data.frame witch nedd to be labelised |
varLabel |
a data.frame with two columns : 1) the variable colname, 2) the clean label to display |
varIndex |
a numeric vector of length one, containing the index if the variable label column. |
labelIndex |
a numeric vector of length one, containing the index if the variable label column. |
a data.frame with the var_label attribute
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(mtcars)
label <- data.frame(VARIABLE = colnames(mtcars),
LABEL = c("Miles/(US) gallon",
"Number of cylinders",
"Displacement (cu.in.)",
"Gross horsepower",
"Rear axle ratio",
"Weight (1000 lbs)",
"1/4 mile time",
"Engine (0 = V-shaped, 1 = straight)",
"Transmission (0 = automatic, 1 = manual)",
"Number of forward gears",
"Number of carburetors"),
stringsAsFactors = FALSE)
labeled_df <- setLabelToVariable(mtcars, label)
lapply(labeled_df, function(x) attributes(x)$`var_label`)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.