Creates a character vector describing presence/absence of missing values

label_missings(data, ..., missing = "Missing",
  complete = "Not Missing")

Arguments

data

a dataframe or set of vectors of the same length

...

extra variable to label

missing

character a label for when values are missing - defaults to "Missing"

complete

character character a label for when values are complete - defaults to "Not Missing"

Value

character vector of "Missing" and "Not Missing".

See also

Examples

label_missings(airquality)
#> [1] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [6] "Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [11] "Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [16] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [21] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [26] "Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" #> [31] "Not Missing" "Missing" "Missing" "Missing" "Missing" #> [36] "Missing" "Missing" "Not Missing" "Missing" "Not Missing" #> [41] "Not Missing" "Missing" "Missing" "Not Missing" "Missing" #> [46] "Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [51] "Not Missing" "Missing" "Missing" "Missing" "Missing" #> [56] "Missing" "Missing" "Missing" "Missing" "Missing" #> [61] "Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [66] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [71] "Not Missing" "Missing" "Not Missing" "Not Missing" "Missing" #> [76] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [81] "Not Missing" "Not Missing" "Missing" "Missing" "Not Missing" #> [86] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [91] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [96] "Missing" "Missing" "Missing" "Not Missing" "Not Missing" #> [101] "Not Missing" "Missing" "Missing" "Not Missing" "Not Missing" #> [106] "Not Missing" "Missing" "Not Missing" "Not Missing" "Not Missing" #> [111] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [116] "Not Missing" "Not Missing" "Not Missing" "Missing" "Not Missing" #> [121] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [126] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [131] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [136] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [141] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Not Missing" #> [146] "Not Missing" "Not Missing" "Not Missing" "Not Missing" "Missing" #> [151] "Not Missing" "Not Missing" "Not Missing"
library(dplyr) airquality %>% mutate(is_missing = label_missings(airquality)) %>% head()
#> Ozone Solar.R Wind Temp Month Day is_missing #> 1 41 190 7.4 67 5 1 Not Missing #> 2 36 118 8.0 72 5 2 Not Missing #> 3 12 149 12.6 74 5 3 Not Missing #> 4 18 313 11.5 62 5 4 Not Missing #> 5 NA NA 14.3 56 5 5 Missing #> 6 28 NA 14.9 66 5 6 Missing
airquality %>% mutate(is_missing = label_missings(airquality, missing = "definitely missing", complete = "absolutely complete")) %>% head()
#> Ozone Solar.R Wind Temp Month Day is_missing #> 1 41 190 7.4 67 5 1 absolutely complete #> 2 36 118 8.0 72 5 2 absolutely complete #> 3 12 149 12.6 74 5 3 absolutely complete #> 4 18 313 11.5 62 5 4 absolutely complete #> 5 NA NA 14.3 56 5 5 definitely missing #> 6 28 NA 14.9 66 5 6 definitely missing