pctr-deprecated | R Documentation |
Given a proportion (0 < p < 1), the function converts it to a percent (0 <
pct < 100) as either a numeric (when as_text = FALSE
) or as a string with a
percent sign (as_text = TRUE
). I owe this one to my buddy Kyle Hart.
scales::percent()
has always been my preferred way to format percents but
this function has a little more flexibility and the number of decimal places
can be specified.
pctr(x, d, as_text, latex)
x |
A numeric vector. |
d |
integer indicating the number of decimal places (round). |
as_text |
logical; if FALSE, a numeric value is returned; if TRUE, then a character is returned with a percent symbol |
latex |
logical; default is |
An object of similar structure to x
lamisc-deprecated
pctr(x = runif(10), d = 1)
pctr(x = runif(10), d = 1, latex = TRUE)
pctr(x = runif(10), d = 1, as_text = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.