Skip to contents

# Print label, and if missing print variable name

Source: `R/data_plots.R`
`get_label.Rd`

Print label, and if missing print variable name

## Usage

    get_label(data, var = NULL)

## Arguments

data

  vector or data frame

## Value

character string

## Examples

    mtcars |> get_label(var = "mpg")
    #> [1] "mpg"
    mtcars |> get_label()
    #> [1] "mtcars"
    mtcars$mpg |> get_label()
    #> [1] "mtcars$mpg"
    gtsummary::trial |> get_label(var = "trt")
    #> [1] "Chemotherapy Treatment"
    1:10 |> get_label()
    #> [1] "1:10"