Skip to content

Commit

Permalink
Resolves #241.
Browse files Browse the repository at this point in the history
This is a bug in `gg_miss_fct()` where warning is given for non explicit NA values see [241](#241).
  • Loading branch information
njtierney committed Oct 22, 2019
1 parent 8cd5ea1 commit 630c3d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
## Minor changes

- use `map_dfc` instead of `map_df`
- Fix various extra warnings and improve test coverage

## Big Fix

- Address bug where the number of missings in a row is not calculated properly - see [238](https://github.com/njtierney/naniar/issues/238) and [232](https://github.com/njtierney/naniar/issues/232). The solution involved using rowSums(is.na(x)), which was 3 times faster.
- Resolve bug in `gg_miss_fct()` where warning is given for non explicit NA values - see [241](https://github.com/njtierney/naniar/issues/241).

# naniar 0.4.2.9001 (2019/04/17)

Expand Down
7 changes: 5 additions & 2 deletions R/gg-miss-fct.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ gg_miss_fct <- function(x, fct){
fct <- rlang::enquo(fct)

data <- x %>%
# protect against error where grouping by missing value leads to
# warning message from dplyr about explicit
dplyr::mutate_at(vars(!!fct), .funs = coerce_fct_na_explicit) %>%
dplyr::group_by(!!fct) %>%
miss_var_summary()

ggobject <-
ggplot(data,
aes_string(quo_name(fct),
"variable",
aes_string(x = quo_name(fct),
y = "variable",
fill = "pct_miss")) +
geom_tile() +
viridis::scale_fill_viridis(name = "% Miss") +
Expand Down

0 comments on commit 630c3d6

Please sign in to comment.