R中的kableExtra中的column_spec函数不起作用 [英] column_spec function in kableExtra in R doesn't work
本文介绍了R中的kableExtra中的column_spec函数不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用kable(,'latex')共同更改pdf中的列宽,但是该功能不起作用.有人知道为什么吗?这是我的代码:
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)
推荐答案
这不是bug,而是knitr::kable()
中align
的一个相对奇怪的设置.在xtable
中,可以将align放在字符串中,但对于kable
,则必须提供一个向量.就您而言,如果放置align = c(rep("l", 2), rep("r"), 2)
之类的东西,那应该没问题.
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.
这篇关于R中的kableExtra中的column_spec函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文