Once data is in nabular form, where the shadow is bound to the data, it can be useful to reshape it into a long format with the columns

shadow_long(shadow_data, ..., only_main_vars = TRUE)

Arguments

shadow_data

a data.frame

...

bare name of variables that you want to focus on

only_main_vars

logical - do you want to filter down to main variables?

Value

data in long format, with columns variable, value, variable_NA, and value_NA.

Examples

aq_shadow <- bind_shadow(airquality) shadow_long(aq_shadow)
#> # A tibble: 918 x 4 #> variable value variable_NA value_NA #> <chr> <dbl> <chr> <chr> #> 1 Ozone 41 Ozone_NA !NA #> 2 Ozone 36 Ozone_NA !NA #> 3 Ozone 12 Ozone_NA !NA #> 4 Ozone 18 Ozone_NA !NA #> 5 Ozone NA Ozone_NA NA #> 6 Ozone 28 Ozone_NA !NA #> 7 Ozone 23 Ozone_NA !NA #> 8 Ozone 19 Ozone_NA !NA #> 9 Ozone 8 Ozone_NA !NA #> 10 Ozone NA Ozone_NA NA #> # ... with 908 more rows
# then filter only on Ozone shadow_long(aq_shadow, Ozone)
#> # A tibble: 153 x 4 #> variable value variable_NA value_NA #> <chr> <dbl> <chr> <chr> #> 1 Ozone 41 Ozone_NA !NA #> 2 Ozone 36 Ozone_NA !NA #> 3 Ozone 12 Ozone_NA !NA #> 4 Ozone 18 Ozone_NA !NA #> 5 Ozone NA Ozone_NA NA #> 6 Ozone 28 Ozone_NA !NA #> 7 Ozone 23 Ozone_NA !NA #> 8 Ozone 19 Ozone_NA !NA #> 9 Ozone 8 Ozone_NA !NA #> 10 Ozone NA Ozone_NA NA #> # ... with 143 more rows
shadow_long(aq_shadow, Ozone, Solar.R)
#> # A tibble: 306 x 4 #> variable value variable_NA value_NA #> <chr> <dbl> <chr> <chr> #> 1 Ozone 41 Ozone_NA !NA #> 2 Ozone 36 Ozone_NA !NA #> 3 Ozone 12 Ozone_NA !NA #> 4 Ozone 18 Ozone_NA !NA #> 5 Ozone NA Ozone_NA NA #> 6 Ozone 28 Ozone_NA !NA #> 7 Ozone 23 Ozone_NA !NA #> 8 Ozone 19 Ozone_NA !NA #> 9 Ozone 8 Ozone_NA !NA #> 10 Ozone NA Ozone_NA NA #> # ... with 296 more rows