Skip to content

Commit

Permalink
Merge tag 'v1.2.1'
Browse files Browse the repository at this point in the history
Display
-------

- 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 shown anymore if all displayed numbers are whole numbers (#62).
- Decimal values longer than 13 characters always print in scientific notation.

Bug fixes
---------

- 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 computation of significant figures for numbers with absolute value >= 1 (#98).

New functions
-------------

- New styling helper `style_subtle_num()`, formatting depends on the `pillar.subtle_num` option.
  • Loading branch information
krlmlr committed Feb 27, 2018
2 parents 8472829 + 3049c56 commit 2065df9
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 54 deletions.
2 changes: 1 addition & 1 deletion API
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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"),
Expand Down
4 changes: 2 additions & 2 deletions 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).
Expand Down
4 changes: 2 additions & 2 deletions R/sigfig.R
Expand Up @@ -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)
))
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions R/styles.R
Expand Up @@ -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)
}
}

Expand Down
6 changes: 3 additions & 3 deletions 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
Expand All @@ -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.
6 changes: 3 additions & 3 deletions docs/authors.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/index.html

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

12 changes: 6 additions & 6 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/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/style_subtle.html

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

4 changes: 2 additions & 2 deletions man/style_subtle.Rd

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

21 changes: 12 additions & 9 deletions revdep/check.R
@@ -1,5 +1,8 @@
if (Sys.getenv("DISPLAY") == "") stop("Run with xvfb-run")

free <- system(paste0("df --output=avail ", tempdir(), " | tail -n 1"), intern = TRUE)
if (as.numeric(free) < 1e8) stop("Set TMPDIR to a location with at least 100 GB free space")

package <- basename(getwd())

library(revdepcheck)
Expand All @@ -15,7 +18,7 @@ if (length(revdep_todo()) == 0) {
import_revdeps <- setdiff(import_revdeps, package)
todo_import_revdeps <- import_revdeps

while (length(todo_import_revdeps) > 0) {
while (FALSE && length(todo_import_revdeps) > 0) {
print(length(todo_import_revdeps))
print(todo_import_revdeps)
print(Sys.time())
Expand All @@ -36,21 +39,21 @@ if (length(revdep_todo()) == 0) {
options(repos = revdepcheck:::get_repos(bioc = TRUE))

todo <- revdep_todo()
withr::with_temp_libpaths(action = "replace", {
crancache::install_packages(c(
todo,
"pillar"
))
dir.create("revdep/warmup_lib", showWarnings = FALSE)
withr::with_libpaths("revdep/warmup_lib", action = "replace", {
crancache::update_packages(ask = FALSE)
crancache::install_packages(setdiff(todo, rownames(installed.packages())))

remotes::install_local(".")
crancache::download_packages(todo, destdir = tempdir())
})

repos <- paste0(
"file://",
file.path(crancache::get_cache_dir(), c("cran-bin", "bioc-bin", "other-bin"))
file.path(crancache::get_cache_dir(), c("cran-bin", "cran", "bioc-bin", "bioc"))
)

names(repos) <- c("CRAN", "Bioc", "other")
names(repos) <- c("CRAN", "CRAN-src", "Bioc", "Bioc-src")

options(repos = repos)

Expand All @@ -61,7 +64,7 @@ for (i in seq_len(N)) {
bioc = TRUE,
dependencies = character(),
quiet = FALSE,
num_workers = 24,
num_workers = 40,
timeout = as.difftime(60, units = "mins")
)
)
Expand Down
9 changes: 7 additions & 2 deletions revdep/drake.R
Expand Up @@ -9,7 +9,11 @@ make_subset_available <- function(pkg) {
}

subset_available <- function(available, pkg) {
available[pkg, , drop = FALSE]
if (pkg %in% rownames(available)) {
available[pkg, , drop = FALSE]
} else {
available[integer(), , drop = FALSE]
}
}

plan_available <-
Expand Down Expand Up @@ -223,9 +227,9 @@ plan <-
plan_compare,
plan_compare_all,
plan_install,
plan_available,
plan_base_libs,
plan_download,
plan_available,
plan_deps
)

Expand All @@ -234,6 +238,7 @@ plan <-
make(
plan,
"compare_all",
keep_going = TRUE,
#parallelism = "future"
, jobs = parallel::detectCores()
)
4 changes: 4 additions & 0 deletions tests/testthat/out-native/lubridate.txt
@@ -0,0 +1,4 @@
<S4: Duration>
1s
2s
3s
2 changes: 1 addition & 1 deletion tests/testthat/out/basic-signif-5.txt
@@ -1,5 +1,5 @@
<dbl>
-0.010000
-0.010000
0.10000
-1.0000
10.000
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/out/basic-signif-7.txt
@@ -1,9 +1,9 @@
<dbl>
-1.000000
0.1000000
-0.01000000
-0.01000000
0.001000000
-0.0001000000
-0.0001000000
0.00001000000
NA
-Inf
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/out/basic.txt
@@ -1,11 +1,11 @@
<dbl>
-0.00100
-0.00100
0.0100
-0.100
-0.100
1.00
-10.0
100.
-1000.
-1000.
10000.
NA
-Inf
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/out/style-bold-false.txt
@@ -1,10 +1,10 @@
x
<dbl>
1 -0.00100
1 -0.00100
2 0.0100
3 -0.100
3 -0.100
4 1.00
5 -10.0
6 100.
7 -1000.
7 -1000.
8 10000.
6 changes: 3 additions & 3 deletions tests/testthat/out/style-regular.txt
@@ -1,10 +1,10 @@
x
<dbl>
1 -0.00100
1 -0.00100
2 0.0100
3 -0.100
3 -0.100
4 1.00
5 -10.0
6 100.
7 -1000.
7 -1000.
8 10000.
6 changes: 3 additions & 3 deletions tests/testthat/out/style-subtle-false.txt
@@ -1,10 +1,10 @@
x
<dbl>
1 -0.00100
1 -0.00100
2 0.0100
3 -0.100
3 -0.100
4 1.00
5 -10.0
6 100.
7 -1000.
7 -1000.
8 10000.

0 comments on commit 2065df9

Please sign in to comment.