New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prop_miss_case when each row has missing value #238
Comments
Heya @emilelatour ! Thanks for the bug report :) Can confirm that I get the same bug - I think this is also in #232 I'll try and get this sorted soon, thanks for taking the time to post a great issue. Cheers, Nick |
Minimal replication (drawing from @earowang)'s #232 library(naniar)
prop_miss_case(data.frame(x = NA))
#> [1] 0
n_case_complete(data.frame(x = NA))
#> [1] 0
prop_complete_case(data.frame(x = NA))
#> [1] 1 Created on 2019-10-19 by the reprex package (v0.3.0) |
Current behaviour: # This tests against
bad_air_quality <- tibble::tribble(
~Ozone, ~Solar.R, ~Wind, ~Temp, ~Month, ~Day,
NA, 190, 7.4, 67, 5, 1,
36, NA, 8, 72, 5, 2,
12, 149, NA, 74, 5, 3,
18, 313, 11.5, NA, 5, 4,
NA, NA, 14.3, 56, NA, 5,
28, NA, 14.9, 66, 5, NA,
NA, 190, 7.4, 67, 5, 1,
36, NA, 8, 72, 5, 2,
12, 149, NA, 74, 5, 3,
18, 313, 11.5, NA, 5, 4,
NA, NA, 14.3, 56, NA, 5,
28, NA, 14.9, 66, 5, NA
)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tibble)
library(naniar)
bad_air_quality %>%
summarise(n_missing = n_case_miss(.),
n_complete = n_case_complete(.),
prop_missing = prop_miss_case(.),
prop_complete = prop_complete_case(.))
#> # A tibble: 1 x 4
#> n_missing n_complete prop_missing prop_complete
#> <int> <int> <dbl> <dbl>
#> 1 12 0 1 0 Created on 2019-10-21 by the reprex package (v0.3.0) |
Awesome!! Thanks @njtierney !! Confirmed that this is fixed with my work data set!! |
Hey Nick!
Hope you're well!!
I was using the
naniar
package on a work data set that had at least one missing value in each observation. So >= 1 missing value on each row in the data frame. I expected thatnaniar::propr_miss_case
would return1.00
but instead it returns0.00
. Similar withnaniar::prop_complete_case
. I recreated this with the reprex below. I think that my intuition is correct and something odd might be going on.Thanks for making the wonderful package!
Best,
Emile
Created on 2019-10-18 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: