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.
big_mark(x, big.mark = ",", ...)
prcn(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.
Character, used as mark between every 3 decimals before the decimal point.
Other arguments passed down to the prettyNum
-function.
For big_mark()
, a prettified x
as character, with big marks.
For prcn
, a character vector with a percentage number.
# simple big mark
big_mark(1234567)
#> [1] "1,234,567"
# big marks for several values at once, mixed numeric and character
big_mark(c(1234567, "55443322"))
#> [1] " 1,234,567" "55,443,322"
# pre-defined width of character output
big_mark(c(1234567, 55443322), width = 15)
#> [1] " 1,234,567" " 55,443,322"
# convert numbers into percentage, as character
prcn(0.2389)
#> [1] "23.89%"
prcn(c(0.2143887, 0.55443, 0.12345))
#> [1] "21.44%" "55.44%" "12.35%"
dat <- data.frame(
a = c(.321, .121, .64543),
b = c("a", "b", "c"),
c = c(.435, .54352, .234432)
)
prcn(dat)
#> a b c
#> 1 32.10% a 43.50%
#> 2 12.10% b 54.35%
#> 3 64.54% c 23.44%