R tableGrob change format of row

前端 未结 3 1827
感动是毒
感动是毒 2021-01-03 13:31

I have some relatively simple code to create a table for printing to a PDF:

library(gridExtra)
df <- head(iris)
tableGrob(df, gp = gpar(fontsize = 8), row         


        
3条回答
  •  既然无缘
    2021-01-03 14:27

    I've just remembered that the formatting parameters get recycled (but only with a sane logic after version >=2.2.0), so you can do,

    library(gridExtra)
    library(grid)
    t1 <- ttheme_default(core=list(
            fg_params=list(fontface=c(rep("plain", 4), "bold.italic")),
            bg_params = list(fill=c(rep(c("grey95", "grey90"),
                                        length.out=4), "#6BAED6"))
            ))
    
    grid.newpage()
    grid.table(iris[1:5, 1:3], theme=t1)
    

提交回复
热议问题