Add a layout column to long format data for mixed layouts.
Source:R/gghm_tidy.R
add_mixed_layout.Rd
Add a layout column to long format data for mixed layouts.
Value
The input data frame with a new column added, showing in which triangle each value would be in a mixed layout.
Examples
# Make long format symmetric data
long_df <- data.frame(rw = rep(letters[1:4], 4),
cl = rep(letters[1:4], each = 4),
val = 0)
long_df <- add_mixed_layout(long_df, rw, cl, val,
layout = c("topleft", "bottomright"))
head(long_df)
#> rw cl val layout
#> 1 a a 0 topleft
#> 2 b a 0 topleft
#> 3 c a 0 topleft
#> 4 d a 0 topleft
#> 5 a b 0 bottomright
#> 6 b b 0 topleft