Skip to content

Commit

Permalink
v1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
msberends committed May 25, 2021
1 parent 0f5299f commit 9a4f79f
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 44 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cleaner
Title: Fast and Easy Data Cleaning
Version: 1.5.1.9000
Date: 2021-04-12
Version: 1.5.2
Date: 2021-05-24
Authors@R:
person(
given = c("Matthijs", "S."),
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cleaner 1.5.1.9000
# cleaner 1.5.2

* Fix for latest R-devel, that does not allow `digits = 0` for `format()`
* `clean_Date()` now supports month-year format for which it sets the day as 1:
```r
clean_Date("March")
Expand Down
4 changes: 2 additions & 2 deletions R/freq.R
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
na_txt <- paste0(format(header$na_length, decimal.mark = decimal.mark, big.mark = big.mark), " = ",
sub("NaN", "0", percentage(header$na_length / header$length,
digits = getdecimalplaces(header$na_length / header$length,
minimum = 0,
minimum = 1,
maximum = digits),
decimal.mark = decimal.mark),
fixed = TRUE))
Expand All @@ -554,7 +554,7 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
header$available <- paste0(format(header$available, decimal.mark = decimal.mark, big.mark = big.mark),
" (", trimws(percentage(header$available / header$length,
digits = getdecimalplaces(header$available / header$length,
minimum = 0,
minimum = 1,
maximum = digits),
decimal.mark = decimal.mark)),
na_txt, ")")
Expand Down
4 changes: 2 additions & 2 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gsub_warn_on_error <- function(pattern, replacement, x, ignore.case = FALSE, per

# works exactly like round(), but rounds `round(44.55, 1)` as 44.6 instead of 44.5
# and adds decimal zeroes until `digits` is reached when force_zero = TRUE
round2 <- function(x, digits = 0, force_zero = TRUE) {
round2 <- function(x, digits = 1, force_zero = TRUE) {
x <- as.double(x)
# https://stackoverflow.com/a/12688836/4575331
val <- (trunc((abs(x) * 10 ^ digits) + 0.5) / 10 ^ digits) * sign(x)
Expand All @@ -62,7 +62,7 @@ round2 <- function(x, digits = 0, force_zero = TRUE) {
as.double(val)
}

getdecimalplaces <- function(x, minimum = 0, maximum = 3) {
getdecimalplaces <- function(x, minimum = 1, maximum = 3) {
if (maximum < minimum) {
maximum <- minimum
}
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/authors.html

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

2 changes: 1 addition & 1 deletion docs/index.html

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

9 changes: 5 additions & 4 deletions docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pandoc: 2.11.2
pkgdown: 1.6.1
pkgdown_sha: ~
articles: {}
last_built: 2021-04-12T09:05Z
last_built: 2021-05-24T14:28Z

2 changes: 1 addition & 1 deletion docs/reference/clean.html

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

2 changes: 1 addition & 1 deletion docs/reference/currency.html

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

8 changes: 4 additions & 4 deletions docs/reference/format_datetime.html

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

2 changes: 1 addition & 1 deletion docs/reference/format_names.html

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

2 changes: 1 addition & 1 deletion docs/reference/format_p_value.html

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

26 changes: 13 additions & 13 deletions docs/reference/freq.html

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

2 changes: 1 addition & 1 deletion docs/reference/index.html

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

4 changes: 2 additions & 2 deletions docs/reference/na_replace.html

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

4 changes: 2 additions & 2 deletions docs/reference/percentage.html

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

2 changes: 1 addition & 1 deletion docs/reference/rdate.html

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

2 changes: 1 addition & 1 deletion docs/reference/regex_true_false.html

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

2 changes: 1 addition & 1 deletion docs/reference/unclean.html

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

0 comments on commit 9a4f79f

Please sign in to comment.