Cin1
February 5, 2021, 3:37pm
1
Hi, I am new in using R. I am trying to create tables in R markdown, with kable. I want to modify the header of the table (bold, different colors by columns). The cmd "row_spec(1, bold = T)" just allows me to modify the first row. How can i move on the header?
kbl(dt) %>%
kable_classic("striped", full_width = F) %>%
row_spec(1, bold = T) %>%
row_spec(3:5, bold = T, color = "white", background = "#D7261E")
Thank you in advance
Welcome to the community!
This may sound very obvious, but have you tried 0?
I haven't tried myself, but asking because of this .
@Cin1 , glad it worked. Did you try column_spec
along with background
option? The above link has lots of examples.
And just for moderating purposes, can you mark your problem as solved? This may help:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
Cin1
February 5, 2021, 4:11pm
3
It works, thanks. Do you also know how to change the colors to the single columns in the header?
system
Closed
February 12, 2021, 4:11pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.