Header modification

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:

It works, thanks. Do you also know how to change the colors to the single columns in the header?

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.