sarahbarnes
sarahbarnes

Reputation: 123

R Color Every Other Row

Is there a way to create an R table (I want to eventually output it as a PNG). With every other row colored? All of the options I am seeing to color rows are based on the row value and the number of rows and row values will be dynamic so I can't do it that way.

Below is an example of what I want enter image description here

Upvotes: 3

Views: 1281

Answers (1)

Greg
Greg

Reputation: 3650

You can use theme_zebra from flextable

library(flextable)
ftab <- flextable(head(iris))
theme_zebra(ftab)

enter image description here

Upvotes: 2

Related Questions