num_abbr: Abbreviate or dis-abbreviate numerical values

View source: R/wrangling.R

num_abbrR Documentation

Abbreviate or dis-abbreviate numerical values

Description

This function converts a numeric vector's values into their abbreviated character equivalent, i.e. 100E6 into 100M and viceversa.

Usage

num_abbr(x, n = 3, numeric = FALSE, ...)

Arguments

x

Numeric vector

n

Integer. Single numeric value, specifying number of significant figures to show. Range 1 to 6.

numeric

Boolean. Transform abbreviated number into numeric?

...

Additional parameters.

Value

Vector of character or numeric values that contain converted values

See Also

Other Data Wrangling: balance_data(), categ_reducer(), cleanText(), date_cuts(), date_feats(), file_name(), formatHTML(), holidays(), impute(), left(), normalize(), ohe_commas(), ohse(), quants(), removenacols(), replaceall(), replacefactor(), textFeats(), textTokenizer(), vector2text(), year_month(), zerovar()

Examples

num_abbr(rnorm(10) * 1e6)
num_abbr(rnorm(10) * 1e6, n = 1)
num_abbr(c("3K", "-58.3M", NA, 1), numeric = TRUE)

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.