# NOT RUN {
# Use `sp500` to create a gt table;
# merge the `open` & `close` columns
# together, and, the `low` & `high`
# columns (putting an em dash between
# both); rename the columns
tab_1 <-
sp500 %>%
dplyr::slice(50:55) %>%
dplyr::select(-volume, -adj_close) %>%
gt() %>%
cols_merge(
columns = vars(open, close),
hide_columns = vars(close),
pattern = "{1}—{2}"
) %>%
cols_merge(
columns = vars(low, high),
hide_columns = vars(high),
pattern = "{1}—{2}"
) %>%
cols_label(
open = "open/close",
low = "low/high"
)
# }
Run the code above in your browser using DataLab