Adjust row height xtable R

折月煮酒 提交于 2019-12-12 08:44:32

问题


There are couple of helpful posts round dealing with xtable but no one deals with this as far as my search abilities go.

I would like to adjust row height in xtable (print). I'm printing a data.frame.

print(xtable(...),...)

Please note that I'm already using add.to.row

addtorow <- list()
addtorow$pos <- list()
addtorow$pos[[1]] <- c(0)
addtorow$command <- c(paste("\\hline \n","\\hline \n",sep=""))

So what I would like to do is to widen the upper row space:

I have tried all kind of things but always just messing around what I have already nicely done.


回答1:


You could simply use the booktabs option which increases the padding around the horizontal lines

print(xtable(...),booktabs = T)



回答2:


Not sure exactly the context here- if you're using LaTeX or if you're printing the table in html (using R Markdown and rendering as a webpage. In the latter case you can specify padding on the table cells using CSS rules at the top of your document between style tags:

<style>
  th,td{
     padding:2px 5px 2px 5px;
  }
</style>


来源:https://stackoverflow.com/questions/19447577/adjust-row-height-xtable-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!