-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow the comma sep function to handle non-numeric values (#79)
* allow the comma sep function to handle non-numeric values * update docs * update version to v0.4.1
- Loading branch information
Showing
5 changed files
with
16 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: dfeR | ||
Title: Common DfE R tasks | ||
Version: 0.4.0 | ||
Version: 0.4.1 | ||
Authors@R: c( | ||
person("Cam", "Race", , "[email protected]", role = c("aut", "cre")), | ||
person("Laura", "Selby", , "[email protected]", role = "aut"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
#' Comma separate | ||
#' | ||
#' @description | ||
#' Adds separating commas to big numbers. | ||
#' Adds separating commas to big numbers. If a value is not numeric it will | ||
#' return the value unchanged and as a string. | ||
#' | ||
#' @param number number to be comma separated | ||
#' | ||
#' @return string containing comma separated number | ||
#' @return string | ||
#' @export | ||
#' | ||
#' @examples | ||
#' comma_sep(100) | ||
#' comma_sep(1000) | ||
#' comma_sep(3567000) | ||
comma_sep <- function(number) { | ||
if (!is.numeric(number)) { | ||
stop("number must be a numeric value") | ||
} | ||
|
||
format(number, big.mark = ",", trim = TRUE, scientific = FALSE) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters