Skip to content

Commit

Permalink
added f_num example for dplyr
Browse files Browse the repository at this point in the history
  • Loading branch information
trinker committed Dec 22, 2016
1 parent 31201e9 commit 7667f35
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/f_num.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
#' ## Units
#' f_num(c(30, 33.45, .1), 2, s=" in.<sup>2</sup>")
#' f_num(c(30, 33.45, .1), 2, p="&Chi;<sup>2</sup>=")
#'
#' \dontrun{
#' library(dplyr)
#' is.int <- function(x) !all(x %% 1 == 0)
#'
#' mtcars %>%
#' mutate_if(.funs = f_num, is.int)
#' }
f_num <- function(x, digits = getOption("numformdigits"), p, s) {

if (is.null(digits)) digits <- 1
Expand Down
2 changes: 2 additions & 0 deletions R/fv_percent_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#' )
#'
#' \dontrun{
#' library(dplyr)
#'
#' CO2 %>%
#' group_by(Plant) %>%
#' mutate(
Expand Down
8 changes: 8 additions & 0 deletions man/f_num.Rd

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

2 changes: 2 additions & 0 deletions man/fv_percent_diff.Rd

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

0 comments on commit 7667f35

Please sign in to comment.