waldo
waldo copied to clipboard
NA values not displayed
NA
values are not displayed. This happens with the current CRAN and the current dev version
waldo::compare(
c(NA, 1),
1
)
#> `old`: 1
#> `new`: 1
Created on 2021-09-24 by the reprex package (v2.0.1)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os macOS Big Sur 10.16
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz UTC
#> date 2021-09-24
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.1.0)
#> cli 3.0.1.9000 2021-09-24 [1] Github (r-lib/cli@f0f8543)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
#> diffobj 0.3.4 2021-03-22 [1] CRAN (R 4.1.0)
#> digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.0)
#> knitr 1.34 2021-09-09 [1] CRAN (R 4.1.0)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
#> pillar 1.6.2.9000 2021-08-09 [1] Github (r-lib/pillar@9f20762)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.0)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.0)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.0)
#> R.utils 2.10.1 2020-08-26 [1] CRAN (R 4.1.0)
#> rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.1.0)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.0)
#> rlang 0.4.11.9001 2021-09-24 [1] Github (r-lib/rlang@b60adbe)
#> rmarkdown 2.11 2021-09-14 [1] CRAN (R 4.1.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> stringi 1.7.4 2021-08-25 [1] CRAN (R 4.1.0)
#> stringr 1.4.0.9000 2021-08-23 [1] Github (tidyverse/stringr@6670a37)
#> styler 1.6.2 2021-09-23 [1] CRAN (R 4.1.0)
#> tibble 3.1.4 2021-08-25 [1] CRAN (R 4.1.0)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
#> vctrs 0.3.8.9001 2021-09-24 [1] Github (r-lib/vctrs@abd12db)
#> waldo 0.3.1.9000 2021-09-24 [1] Github (r-lib/waldo@8e22b22)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
#> xfun 0.26 2021-09-14 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
I'm reasonably confident that this isn't a regression, and it only occurs when the missing values are at the beginning or end of the vector:
waldo::compare(c(1, NA, 3), c(1, 2, 3))
#> `old`: 1 NA 3
#> `new`: 1 2 3
Created on 2021-09-28 by the reprex package (v2.0.1)
The problem appears to be in format_diff_matrix()
— after alignment there's an ambiguity about where a missing value comes from — is from in the original vector (in which case it should be shown) or is it from alignment (in which case it should be replaced with ""
).
A variant, or an entirely different bug?
waldo::compare(NA_character_, "NA")
#> ✔ No differences
waldo::compare(NA_character_, "NaN")
#> `old`: NA
#> `new`: "NaN"
Created on 2023-03-29 with reprex v2.0.2
@krlmlr I think that's a different bug; tracking in #162