get_all_lab_atts {labelr}R Documentation

Put all Data Frame label attributes into a List

Description

get_all_lab_atts returns a list of labelr-generated meta-data attributes attached to a data.frame, all of which should have names beginning with one of these character strings: "frame.lab", "name.labs",
"val.labs", "factor.".

Usage

get_all_lab_atts(data, atts = c("name.labs|val.labs|frame.lab|factor."))

Arguments

data

the data.frame you are checking for labelr meta-data attributes.

atts

default is to look for all/any, but you can specify a more narrow subset (or some other, altogether-irrelevant attribute, but do not do that).

Value

A free-standing list of labelr attributes.

Examples

# make toy demographic (gender, raceth, etc.) data set
set.seed(555)
df <- make_demo_data(n = 1000) # another labelr:: function
# let's add variable VALUE labels for variable "raceth"
df <- add_val_labs(df,
  vars = "raceth", vals = c(1:7),
  labs = c("White", "Black", "Hispanic", "Asian", "AIAN", "Multi", "Other"),
  max.unique.vals = 50
)

get_all_lab_atts(df) # returns all; is default
get_all_lab_atts(df, "val.labs") # returns only "val.labs" attributes
get_all_lab_atts(df, "class") # You can (but probably should not) use this way.

[Package labelr version 0.1.5 Index]