Skip to contents

This function returns the list of labels identifying specific variable types in a safeframe object.

Usage

labels(x, show_null = FALSE)

Arguments

x

a safeframe object

show_null

a logical indicating if the complete list of labels, including NULL ones, should be returned; if FALSE, only labels with a non-NULL value are returned; defaults to FALSE

Value

The function returns a named list where names indicate which column they correspond to, and values indicate the relevant labels.

Details

Labels are stored as the label attribute of the column variable.

Examples


## make a safeframe
x <- make_safeframe(cars, speed = "Miles per hour")

## check non-null labels
labels(x)
#> $speed
#> [1] "Miles per hour"
#> 

## get a list of all labels, including NULL ones
labels(x, TRUE)
#> $speed
#> [1] "Miles per hour"
#> 
#> $dist
#> NULL
#>