makeup: makeup

View source: R/makeup.R

makeupR Documentation

makeup

Description

Formats numbers, strings or dates values for human use

Usage

makeup(
  v,
  sample = NULL,
  format = NULL,
  locale = NULL,
  type = NULL,
  suffix = "",
  prefix = "",
  si_prefix = FALSE
)

Arguments

v

value to be formatted

sample

human format to apply in v value

format

a character vector of date-time formats. Default is "%-m/%-d/%Y"

locale

locale to use, for example "es-MX" for mexican. See posible values at makeup::available_locales

type

kind of value to be formatted: ("num", "dat" or "chr")

suffix

Character string to append after formatted value

prefix

Character string to append before formatted value

si_prefix

A logical value indicating whether to use SI prefixes such as "k" and "M" to format the values. If TRUE, the values will be formatted with SI prefixes. If FALSE, standard formatting will be used.

Value

a formatted character value

Examples

x <- c(1234.56, 432141, 0.12)

makeup(x, sample = "1'432.1")
makeup(x, sample = "1,432.1")
makeup(x, sample = "10.8", si_prefix = TRUE)
makeup(x, sample = "10%")


datasketch/makeup documentation built on Feb. 21, 2025, 6:53 a.m.