Quickly convert raw numbers to percentages

make_perc(x, digits = 0, keep_number = TRUE)

Arguments

x

the vector or number that you wish to convert

digits

default value of 0 for zero decimal points after percent

keep_number

default of true to return percentages as numbers, if false then a character string with the %"sign will be outputted

Examples

library(irtools) # Single Value make_perc(.56789)
#> [1] 57
# A vector make_perc(c(.7, .3, .45556543456, .2))
#> [1] 70 30 46 20
# To character make_perc(c(.7, .3, .45556543456, .99), keep_number = FALSE)
#> [1] "70%" "30%" "46%" "99%"