Vectorize arguments to `row_spec` to allow control of individual cell elements.
This resolves #773 by vectorizing the arguments to row_spec and sub-functions.
Example use from the update man page:
x <- head(mtcars)
k <- knitr::kable(x, "html")
# First two rows bold and italic
row_spec(k, 1:2, bold = TRUE, italic = TRUE)
# Color one header background red with white text
row_spec(k,
row = 0,
background=c("","red",rep("",9)),
color=c("","white",rep("",9))
)
# Color columns of header alternating grey and green, via recycling
row_spec(k, 0, color=c('grey','green'))
# Color columns alternating grey and green in all rows, via recycling
row_spec(k, 0:nrow(x), color=c('grey','green'))
# Same thing using `column_spec`:
k |>
column_spec(seq(1, ncol(x)+1, by=2), color='grey') |>
column_spec(seq(2, ncol(x)+1, by=2), color='green')
The conflicts are pretty easy to resolve, but I'm not sure how to add them to the PR. @haozhu233 should take a look and decide whether the changes are desirable.
@dmurdoch I merged in the changes from master and resolved the conflicts.
I think something went wrong in the merge - the removal of spec_barplot (from mini_plots.R) was intentional, and it looks like your change restores it.
Sure, I think this feature aligns with what we have in column_spec (https://github.com/haozhu233/kableExtra/commit/33b865f485c8b394505f202d13c83b60b8a26c5f). @warnes If you get remove spec_barplot that would be great!
I will do a few more testings tonight.
I’ll fix that tomorrow.
On Sun, Dec 3, 2023 at 5:00 PM Hao Zhu @.***> wrote:
Sure, I think this feature aligns with what we have in column_spec ( 33b865f https://github.com/haozhu233/kableExtra/commit/33b865f485c8b394505f202d13c83b60b8a26c5f). @warnes https://github.com/warnes If you get remove spec_barplot that would be great!
I will do a few more testings tonight.
— Reply to this email directly, view it on GitHub https://github.com/haozhu233/kableExtra/pull/774#issuecomment-1837612928, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO4GX6K353KEZAHKCK5ZM3YHTY57AVCNFSM6AAAAAA65XGXO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGYYTEOJSHA . You are receiving this because you were mentioned.Message ID: @.***>
Removed spec_barplot from mini_plots.R and resolved merge conflict.