How to set both column width and text alignment in align argument of xtable?

后端 未结 2 1410
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 09:14

I would like to keep the width of columns I set using align argument of xtable and I would like to align all numeric columns to the right, others to th

2条回答
  •  后悔当初
    2021-01-23 09:51

    I was having the same problem, and want to share this works in R console as

    library(xtable)
    
    irisShort <- head(iris)
    print(xtable(irisShort,
                 digits=rep(0,6),
                 align=c(
                   "p{1cm}|","p{3cm}|",
                   "p{2cm}|","p{3cm}|",
                   "p{3cm}|","p{3cm}|")))
    

提交回复
热议问题