Styling cells based on their content #1779
dhicks
started this conversation in
Show and tell
Replies: 1 comment
-
Within the gt API there is the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context: I'm reporting the results of some exploratory factor analyses, and in the loadings table I need to bold cells whose (absolute) values are greater than 0.3.
It's surprising (to me!) how difficult it is to get gt to style cells individually based on their content across multiple columns. There was a feature request to facilitate in December 2020; it was closed almost two years later when
sub_values()
was added. Butsub_values()
is for manipulating the content of cells, not applying styling, so it's not clear to me why this justified closing the issue.The standard solution still appears to be writing a clunky for loop. I spent a little time this morning converting that into a more flexible function that can be placed in a pipe. MWE below.
Beta Was this translation helpful? Give feedback.
All reactions