unit_shorthand: Easily translate long form unit names to shorthand

View source: R/universal_useful.R

unit_shorthandR Documentation

Easily translate long form unit names to shorthand

Description

Useful for condensed displays like axis titles

Usage

unit_shorthand(x, units = unit_trans)

Arguments

x

chr/tbl Character or data.frame with long form names. Currently supports Acre-feet = AF,Months = mths,Percent = %,Years = yrs,Number = #,Cubic feet per second = Ft^3/s,Million Acre-Feet = MAF,Megawatt-hours = MWh,Megawatts = MW,Gigawatt-hours = GWh,Gigawatt = GW,Feet = Ft

units

chr Unit translation vector with shorthand as the vectur and long form names as the names. Uses unit_trans as default, append additional for specific translations not yet represent in unit_trans and open a PR or issue to add the translations if inclined.

Value

chr/tbl with same class as x

Examples

unit_shorthand(tibble::tibble("Max Gigawatt-hours" = 5, "Really big number" = 10^6))

yogat3ch/UU documentation built on May 31, 2024, 10:14 p.m.