Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用R xtable在latex表中的行之间添加水平线_R_Latex_Xtable - Fatal编程技术网

使用R xtable在latex表中的行之间添加水平线

使用R xtable在latex表中的行之间添加水平线,r,latex,xtable,R,Latex,Xtable,我有这样一个示例latex表生成代码 df<-data.frame(name=rep(letters[1:7],each=24),salary=runif(24*7,100,200)) lst<-tapply(df$salary,df$name,matrix,nrow=4,byrow=T) xlst<-lapply(lst,xtable) df> p>而不是使用循环,考虑使用现有的打印.xTabe>代码>结合粘贴。 < >强> HDASTLYS:< /强>考虑使用 Pri

我有这样一个示例latex表生成代码

df<-data.frame(name=rep(letters[1:7],each=24),salary=runif(24*7,100,200))
lst<-tapply(df$salary,df$name,matrix,nrow=4,byrow=T)
xlst<-lapply(lst,xtable)

<代码> df> p>而不是使用循环,考虑使用现有的<代码>打印.xTabe>代码>结合粘贴。 < >强> HDASTLYS:< /强>考虑使用<代码> Prime.xTabe>代码>参数。例如,有一个参数
hline.after
,用于控制表行之间的水平线

  • vspace:使用
    粘贴可能更简单

  • 例如:

    library(xtable)
    df <- data.frame(name=rep(letters[1:3],each=24),salary=runif(24*3,100,200))
    lst <- tapply(df$salary,df$name,matrix,nrow=4,byrow=T)
    xlst <- lapply(lst,function(x)print(xtable(x), hline.after=1:nrow(x)))
    xlst <- lapply(xlst, paste, "\\vspace{2em}")
    xlst
    
    库(xtable)
    
    df如果您使用的是
    print.xtable
    ,请在
    print.xtable
    中尝试以下操作:


    hline.after=rep(c(1:nrow(df)),2)#在xtable中重复水平线

    +1以发布样本数据和代码。欢迎来到SO。
    library(xtable)
    df <- data.frame(name=rep(letters[1:3],each=24),salary=runif(24*3,100,200))
    lst <- tapply(df$salary,df$name,matrix,nrow=4,byrow=T)
    xlst <- lapply(lst,function(x)print(xtable(x), hline.after=1:nrow(x)))
    xlst <- lapply(xlst, paste, "\\vspace{2em}")
    xlst