Skip to contents

Instead of focussing on labelling whether there are missings, we instead focus on whether there have been any shadows created. This can be useful when data has been imputed and you need to determine which rows contained missing values when the shadow was bound to the dataset.

Usage

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

Arguments

data

data.frame

...

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

data.frame with a column, "any_missing", which describes whether or not there are any rows that have a shadow value.

Examples


airquality %>%
  add_shadow(Ozone, Solar.R) %>%
  add_label_shadow()
#> # A tibble: 153 × 9
#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA any_missing
#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <chr>      
#>  1    41     190   7.4    67     5     1 !NA      !NA        Not Missing
#>  2    36     118   8      72     5     2 !NA      !NA        Not Missing
#>  3    12     149  12.6    74     5     3 !NA      !NA        Not Missing
#>  4    18     313  11.5    62     5     4 !NA      !NA        Not Missing
#>  5    NA      NA  14.3    56     5     5 NA       NA         Missing    
#>  6    28      NA  14.9    66     5     6 !NA      NA         Missing    
#>  7    23     299   8.6    65     5     7 !NA      !NA        Not Missing
#>  8    19      99  13.8    59     5     8 !NA      !NA        Not Missing
#>  9     8      19  20.1    61     5     9 !NA      !NA        Not Missing
#> 10    NA     194   8.6    69     5    10 NA       !NA        Missing    
#> # ℹ 143 more rows