Shadow shift missing values using only the selected variables in a dataset, by specifying variable names or use dplyr vars and dplyr verbs starts_with, contains, ends_with, etc.

add_shadow_shift(data, ..., suffix = "shift")

Arguments

data

data.frame

...

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

suffix

suffix to add to variable, defaults to "shift"

Value

data with the added variable shifted named as var_suffix

See also

Examples

airquality %>% add_shadow_shift(Ozone, Solar.R)
#> # A tibble: 153 x 8 #> Ozone Solar.R Wind Temp Month Day Ozone_shift Solar.R_shift #> <int> <int> <dbl> <int> <int> <int> <dbl> <dbl> #> 1 41 190 7.4 67 5 1 41 190 #> 2 36 118 8 72 5 2 36 118 #> 3 12 149 12.6 74 5 3 12 149 #> 4 18 313 11.5 62 5 4 18 313 #> 5 NA NA 14.3 56 5 5 -19.7 -33.6 #> 6 28 NA 14.9 66 5 6 28 -33.1 #> 7 23 299 8.6 65 5 7 23 299 #> 8 19 99 13.8 59 5 8 19 99 #> 9 8 19 20.1 61 5 9 8 19 #> 10 NA 194 8.6 69 5 10 -18.5 194 #> # … with 143 more rows