View source: R/get_name_labs.R
| get_name_labs | R Documentation | 
For a name-labeled data.frame, get_name_labs returns a derivative
data.frame that lists each variable and its variable name label.
Note: gnl is a compact alias for get_name_labs: they do the same thing,
and the former is easier to type
get_name_labs(data, vars = NULL)
gnl(data, vars = NULL)
data | 
 a data.frame.  | 
vars | 
 a character vector with the name(s) of any specific variable(s) (If NULL, returned data.frame will contain all variable name labels).  | 
A two-column data.frame, consisting of "var" and "lab" columns, where each row corresponds to a unique variable (column) from the user- supplied data.frame.
# create a data set
df <- mtcars
# variable names and their labels
names_labs_vec <- c(
  "mpg" = "Miles/(US) gallon",
  "cyl" = "Number of cylinders",
  "disp" = "Displacement (cu.in.)",
  "hp" = "Gross horsepower",
  "drat" = "Rear axle ratio",
  "wt" = "Weight (1000 lbs)",
  "qsec" = "1/4 mile time",
  "vs" = "Engine (0 = V-shaped, 1 = straight)",
  "am" = "Transmission (0 = automatic, 1 = manual)",
  "gear" = "Number of forward gears",
  "carb" = "Number of carburetors"
)
# assign variable labels
df <- add_name_labs(df,
  vars = names(names_labs_vec),
  labs = names_labs_vec
)
# see what we have
get_name_labs(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.