Learn R Programming

lares (version 5.1.0)

num_abbr: Abbreviate numbers

Description

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

Usage

num_abbr(x, n = 3)

Arguments

x

Numeric vector

n

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

Value

Vector of character values that contain converted values

Examples

Run this code
# NOT RUN {
num_abbr(rnorm(10) * 1e6)
num_abbr(rnorm(10) * 1e6, n = 1)
# }

Run the code above in your browser using DataLab