Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

column_spec function in kableExtra in R doesn't work

Tags:

r

pdf

latex

tex

kable

I want co change column width in pdf with kable ( , 'latex') but the fucntion doesn't work. Anybody know why? here is my code:

   table = knitr::kable(jeden, "latex" , row.names = F ,  align = "llrrrrrrrrrr" , escape = F, booktabs = F, caption = '1. Sprzedaz uslug i towarow razem') 
   kableExtra::column_spec(table, 1, width = "1cm", bold = TRUE, italic = TRUE)
like image 303
dorota Avatar asked Aug 24 '26 18:08

dorota


1 Answers

It's not a bug but rather a relatively strange setting for align in knitr::kable(). In xtable you can put align in a string but for kable, you will have to provide a vector. In your case, if you put things like align = c(rep("l", 2), rep("r"), 2), you should be fine.

like image 148
Hao Avatar answered Aug 26 '26 13:08

Hao