Skip to contents

Shift the values, add shadow, add missing label

Usage

cast_shadow_shift_label(data, ...)

Arguments

data

data.frame

...

One or more unquoted expressions separated by commas. These also respect the dplyr verbs "starts_with", "contains", "ends_with", etc.

Value

data.frame with the shadow and shadow_shift vars, and missing labels

Examples


airquality %>% cast_shadow_shift_label(Ozone, Solar.R)
#> # A tibble: 153 × 7
#>    Ozone Solar.R Ozone_NA Solar.R_NA Ozone_shift Solar.R_shift any_missing
#>    <int>   <int> <fct>    <fct>            <dbl>         <dbl> <chr>      
#>  1    41     190 !NA      !NA               41           190   Not Missing
#>  2    36     118 !NA      !NA               36           118   Not Missing
#>  3    12     149 !NA      !NA               12           149   Not Missing
#>  4    18     313 !NA      !NA               18           313   Not Missing
#>  5    NA      NA NA       NA               -19.7         -33.6 Missing    
#>  6    28      NA !NA      NA                28           -33.1 Missing    
#>  7    23     299 !NA      !NA               23           299   Not Missing
#>  8    19      99 !NA      !NA               19            99   Not Missing
#>  9     8      19 !NA      !NA                8            19   Not Missing
#> 10    NA     194 NA       !NA              -18.5         194   Missing    
#> # ℹ 143 more rows

# replicate the plot generated by geom_miss_point()
if (FALSE) {
library(ggplot2)

airquality %>%
  cast_shadow_shift_label(Ozone,Solar.R) %>%
  ggplot(aes(x = Ozone_shift,
             y = Solar.R_shift,
             colour = any_missing)) +
        geom_point()
}