getVarLabel: Get the label of variable in a data.frame

Description Usage Arguments Value Examples

View source: R/statistic_functions.R

Description

Get the label of variables witch were labelised thanks the setLabel function

Usage

1
getVarLabel(data, variable = colnames(data))

Arguments

data

a data.frame containing colname to get variable label

variable

a character vector, containing the colnames to querry

Value

a named vector of the label of each variable

Examples

 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)
getVarLabel(labeled_df)

rgriffier/statsBordeaux documentation built on Aug. 11, 2021, 9:59 a.m.