Skip to content

Commit

Permalink
Add argument to percent()
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyokc committed Oct 4, 2023
1 parent 2691f8d commit 0e84427
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 7 additions & 5 deletions R/percent.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
percent <- function(x,
digits = 0,
abs = FALSE,
drop0trailing = FALSE
drop0trailing = FALSE,
multiply_by_100 = TRUE,
...
) {

.drop0trailing <- drop0trailing
.digits <- digits
if (abs) {
x <- abs(x)
}
x <- 100 * x

if (abs) { x <- abs(x) }
if (multiply_by_100) { x <- 100 * x }

x <- janitor::round_half_up(x, digits = .digits)
x <-
formatC(
Expand Down
9 changes: 8 additions & 1 deletion man/percent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e84427

Please sign in to comment.