Learn R Programming

lares (version 5.1.4)

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)

Value

Vector of character values that contain converted values

Arguments

x

Numeric vector

n

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

Examples

Run this code
num_abbr(rnorm(10) * 1e6)
num_abbr(rnorm(10) * 1e6, n = 1)

Run the code above in your browser using DataLab