Skip to contents

Creates a character vector describing presence/absence of missing values

Usage

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".

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"

if (FALSE) {
library(dplyr)

airquality %>%
  mutate(is_missing = label_missings(airquality)) %>%
  head()

airquality %>%
  mutate(is_missing = label_missings(airquality,
                                     missing = "definitely missing",
                                     complete = "absolutely complete")) %>%
  head()
}