diff --git a/API b/API index f86236c07..fddc47fef 100644 --- a/API +++ b/API @@ -21,7 +21,7 @@ style_na(x) style_neg(x) style_num(x, negative, significant = rep_along(x, TRUE)) style_subtle(x) -style_subtle_num(x) +style_subtle_num(x, negative) type_sum(x) ## Own S3 methods diff --git a/DESCRIPTION b/DESCRIPTION index 5c09ff787..63b11d202 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pillar Title: Coloured Formatting for Columns -Version: 1.2.0 +Version: 1.2.1 Authors@R: c( person("Kirill", "Müller", , "krlmlr+r@mailbox.org", role = c("aut", "cre")), person("Hadley", "Wickham", role = "aut"), diff --git a/NEWS.md b/NEWS.md index a41a9884b..9be3dcd87 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,9 @@ -# pillar 1.2.0 (2018-02-24) +# pillar 1.2.1 (2018-02-26) Display ------- -- Turned off using subtle style for digits that are considered insignificant. Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`). +- Turned off using subtle style for digits that are considered insignificant. Negative numbers are shown all red. Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`). - The negation sign is printed next to the number again (#91). - Scientific notation uses regular digits again for exponents (#90). - Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78). diff --git a/R/sigfig.R b/R/sigfig.R index 2a527cde4..a7425813f 100644 --- a/R/sigfig.R +++ b/R/sigfig.R @@ -130,7 +130,7 @@ format_lhs <- function(s) { lhs_col <- as.character(ifelse(num, paste0( style_num(lhs_sig, neg, !lhs_zero), - style_subtle_num(lhs_non) + style_subtle_num(lhs_non, neg) ), style_na(lhs_str) )) @@ -223,7 +223,7 @@ underline_3 <- function(x) { #' significant = c(FALSE, FALSE) #' ) style_num <- function(x, negative, significant = rep_along(x, TRUE)) { - ifelse(significant, ifelse(negative, style_neg(x), x), style_subtle_num(x)) + ifelse(significant, ifelse(negative, style_neg(x), x), style_subtle_num(x, negative)) } assemble_decimal <- function(x) { diff --git a/R/styles.R b/R/styles.R index 0e797501a..f8e5012c2 100644 --- a/R/styles.R +++ b/R/styles.R @@ -34,12 +34,12 @@ style_subtle <- keep_empty(function(x) { #' #' @export #' @examples -#' style_subtle_num(0.01) -style_subtle_num <- function(x) { +#' style_subtle_num(0.01 * 1:3, c(TRUE, FALSE, TRUE)) +style_subtle_num <- function(x, negative) { if (isTRUE(getOption("pillar.subtle_num", FALSE))) { style_subtle(x) } else { - x + ifelse(negative, style_neg(x), x) } } diff --git a/cran-comments.md b/cran-comments.md index a1ff9fed5..a48c46fab 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,4 @@ -Update addressing user feedback. +Update addressing bug fix that became apparent only when writing the blog post announcing the release. (Sorry, will write the blog post before submitting to CRAN from now on.) ## Test environments * local Ubuntu 17.10 install, R 3.4.3 @@ -7,8 +7,8 @@ Update addressing user feedback. ## R CMD check results -OK +NOTE for too frequent update (sorry again!) ## revdepcheck results -We checked 6 direct and reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. Only the hms package is now failing, this is due to the changed formatting. I will update hms after pillar 1.2.0 is accepted, not planning any more disruptive updates of pillar in the next months. +Checked all 8 direct downstream packages, no regressions found. diff --git a/docs/authors.html b/docs/authors.html index 5b2359d4d..a128c38af 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -82,15 +82,15 @@

Authors

diff --git a/docs/index.html b/docs/index.html index 36fb63358..c1b6c65f2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -180,9 +180,9 @@

License

GPL-3

Developers

Dev status

diff --git a/docs/news/index.html b/docs/news/index.html index 9df10ae23..453ee6e5b 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -82,19 +82,19 @@

Change log All releases

-
+

-pillar 1.2.0 (2018-02-24)

+pillar 1.2.1 (2018-02-26)

Display

    -
  • Turned off using subtle style for digits that are considered insignificant. Set the new option pillar.subtle_num to TRUE to turn it on again (default: FALSE).
  • +
  • Turned off using subtle style for digits that are considered insignificant. Negative numbers are shown all red. Set the new option pillar.subtle_num to TRUE to turn it on again (default: FALSE).
  • The negation sign is printed next to the number again (#91).
  • Scientific notation uses regular digits again for exponents (#90).
  • Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78).
  • Logical columns are displayed as TRUE and FALSE again (#95).
  • -
  • The decimal dot is now always printed for numbers of type numeric. Trailing zeros are not displayed anymore if all displayed numbers are whole numbers (#62).
  • +
  • The decimal dot is now always printed for numbers of type numeric. Trailing zeros are not shown anymore if all displayed numbers are whole numbers (#62).
  • Decimal values longer than 13 characters always print in scientific notation.
@@ -104,7 +104,7 @@

  • Numeric values with a "class" attribute (e.g., Duration from lubridate) are now formatted using format() if the pillar_shaft() method is not implemented for that class (#88).
  • Very small numbers (like 1e-310) are now printed corectly (tidyverse/tibble#377).
  • -
  • Fix representation of right-hand side for getOption(pillar.sigfig) >= 6 (tidyverse/tibble#380).
  • +
  • Fix representation of right-hand side for getOption("pillar.sigfig") >= 6 (tidyverse/tibble#380).
  • Fix computation of significant figures for numbers with absolute value >= 1 (#98).

@@ -199,7 +199,7 @@

Contents

#> [1] "123" "456"
style_subtle("text")
#> [1] "text"
style_subtle_num(0.01)
#> [1] 0.01
style_bold("Petal.Width")
#> [1] "Petal.Width"
style_na("NA")
#> [1] "NA"
style_neg("123")
#> [1] "123"
+)

#> [1] "123" "456"
style_subtle("text")
#> [1] "text"
style_subtle_num(0.01 * 1:3, c(TRUE, FALSE, TRUE))
#> [1] "0.01" "0.02" "0.03"
style_bold("Petal.Width")
#> [1] "Petal.Width"
style_na("NA")
#> [1] "NA"
style_neg("123")
#> [1] "123"