gt icon indicating copy to clipboard operation
gt copied to clipboard

Add option to format coloring outside of just columns

Open ophamill opened this issue 5 years ago • 2 comments

Great Package!

In toying with some data I'll present in a few months, I noticed the "data_color" function within the gt package doesn't support coloring by rows or coloring specific cells alone. Are there any plans to support that functionality in the future?

ophamill avatar Dec 19 '18 00:12 ophamill

This can be supported, and it should. The rows argument could be introduced to limit the scope of coloring to specified rows.

Side note: there is also the somewhat related issue of whether to add functionality to use data in cells to color adjacent cells.

rich-iannone avatar Dec 23 '18 07:12 rich-iannone

@rich-iannone, I was just looking for the functionality you described in the side-note, i.e. to color an adjacent column and then hide the column with the raw data. It would be great if that could be implemented, maybe with an optional values_from argument?

In case anyone else is looking for a workaround in the meantime: formatting can be moved between columns by changing the colname in the _styles tibble, for instance like this

tab$`_styles`$colname[tab$`_styles`$colname == "impl_bias"] <- "Implicit bias"

LukasWallrich avatar Aug 10 '21 14:08 LukasWallrich