gt icon indicating copy to clipboard operation
gt copied to clipboard

character vector for column labels?

Open apsteinmetz opened this issue 4 years ago • 1 comments

With labeling columns I understand that both uses of cols_label() below are valid but isn't the second, also requiring a named list, superfluous?

gt() %>%
    cols_label(my_label = "My Label", another_one = "Another Label")

gt() %>%
    cols_label(.list= list(my_label = "My Label", another_one = "Another Label"))

It seems that allowing a simple character vector would be an enhancement by reducing typing. Naturally, this would require that all columns get new labels and the character vector be equal to ncol() of the data frame.

gt() %>%
    cols_label(col_names = c("My Label", "Another Label"))

Thanks.

apsteinmetz avatar Sep 01 '21 18:09 apsteinmetz

This is a good idea. We need to think of a nice way to implement this but I'm sure it can be done!

rich-iannone avatar Nov 04 '21 16:11 rich-iannone