Learn R Programming

Hmisc (version 5.1-0)

hlabs: hlabs

Description

Front-end to ggplot2 labs Function

Usage

hlabs(x, y, html = FALSE)

Value

result of ggplot2::labs()

Arguments

x

a single variable name, unquoted

y

a single variable name, unquoted

html

set to TRUE to render in html (for plotly), otherwise the result is plotmath expressions

Author

Frank Harrell

Details

Runs x, y, or both through hlab() and passes the constructed labels to the ggplot2::labs function to specify x- and y-axis labels specially formatted for units of measurement

Examples

Run this code
# Name the current dataset d, or specify a name with
# options(curr_ds='...') or run `extractlabs`, then
# ggplot(d, aes(x,y)) + geom_point() + hlabs(x,y)
# to specify only the x-axis label use hlabs(x), or to
# specify only the y-axis label use hlabs(y=...)

Run the code above in your browser using DataLab