Closed edples closed 1 year ago
Hi there, thanks for noting this, much appreciated!
I've updated the documentation to describe how to search for things like "?" and co, it now looks like this:
library(naniar)
dat_ms <- tibble::tribble(~x, ~y, ~z, ~specials,
1, "A", -100, "?",
3, "N/A", -99, "!",
NA, NA, -98, ".",
-99, "E", -101, "*",
-98, "F", -1, "-")
miss_scan_count(dat_ms,-99)
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 1
#> 2 y 0
#> 3 z 1
#> 4 specials 0
miss_scan_count(dat_ms,c(-99,-98))
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 2
#> 2 y 0
#> 3 z 2
#> 4 specials 0
miss_scan_count(dat_ms,c("-99","-98","N/A"))
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 2
#> 2 y 1
#> 3 z 2
#> 4 specials 0
miss_scan_count(dat_ms, "\\?")
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 0
#> 2 y 0
#> 3 z 0
#> 4 specials 1
miss_scan_count(dat_ms, "\\!")
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 0
#> 2 y 0
#> 3 z 0
#> 4 specials 1
miss_scan_count(dat_ms, "\\.")
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 0
#> 2 y 0
#> 3 z 0
#> 4 specials 1
miss_scan_count(dat_ms, "\\*")
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 0
#> 2 y 0
#> 3 z 0
#> 4 specials 1
miss_scan_count(dat_ms, "-")
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 2
#> 2 y 0
#> 3 z 5
#> 4 specials 1
miss_scan_count(dat_ms,common_na_strings)
#> # A tibble: 4 × 2
#> Variable n
#> <chr> <int>
#> 1 x 4
#> 2 y 4
#> 3 z 5
#> 4 specials 5
Created on 2023-04-10 with reprex v2.0.2
Hello,
If you want to count the "?"s as missing data in your dataframe, you should use
"\\?"
as argument, otherwise the result will be 100% of the "?"s in your data. Example:miss_scan_count(data = training, search = list("?")), n=22)
will output this:The correct use of the function must be:
print(miss_scan_count(data = training, search = list("\\?")), n=22)