R package xtable, how to create a latextable with multiple rows and columns from R

前端 未结 5 685
小鲜肉
小鲜肉 2020-12-13 04:50

My goal is to create latextable with multirow/multicolumn features from R. The latextable I want should look like this:

               colLabel  |  colLabel2         


        
5条回答
  •  悲&欢浪女
    2020-12-13 05:42

    I can't help with the column headers, but for multi row values in the past I've cheated. The function below will set the second and subsequent sets of the same value to NA, and xtable then doesn't display them so you get something that looks vaguely like a multi row value (with top justification)

    cleanf <- function(x){     
        oldx <- c(FALSE, x[-1]==x[-length(x)])  
        # is the value equal to the previous?    
        res <- x
        res[oldx] <- NA
        return(res)} 
    

提交回复
热议问题