Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

big_mark

Format numbers


Description

big_mark() formats large numbers with big marks, while prcn() converts a numeric scalar between 0 and 1 into a character vector, representing the percentage-value.

Usage

big_mark(x, big.mark = ",", ...)

prcn(x)

Arguments

x

A vector or data frame. All numeric inputs (including numeric character) vectors) will be prettified. For prcn(), a number between 0 and 1, or a vector or data frame with such numbers.

big.mark

Character, used as mark between every 3 decimals before the decimal point.

...

Other arguments passed down to the prettyNum-function.

Value

For big_mark(), a prettified x as character, with big marks. For prcn, a character vector with a percentage number.

Examples

# simple big mark
big_mark(1234567)

# big marks for several values at once, mixed numeric and character
big_mark(c(1234567, "55443322"))

# pre-defined width of character output
big_mark(c(1234567, 55443322), width = 15)

# convert numbers into percentage, as character
prcn(0.2389)
prcn(c(0.2143887, 0.55443, 0.12345))

dat <- data.frame(
  a = c(.321, .121, .64543),
  b = c("a", "b", "c"),
  c = c(.435, .54352, .234432)
)
prcn(dat)

sjmisc

Data and Variable Transformation Functions

v2.8.6
GPL-3
Authors
Daniel Lüdecke [aut, cre] (<https://orcid.org/0000-0002-8895-3206>), Iago Giné-Vázquez [ctb], Alexander Bartel [ctb] (<https://orcid.org/0000-0002-1280-6138>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.