Handling Latex backslashes in xtable

前端 未结 2 1414
暖寄归人
暖寄归人 2020-12-14 16:25

I have a table that includes the following column:

 mytable <- data.frame(beta_0 = c(1,2,3)

What I want to do is output a table with a c

2条回答
  •  独厮守ぢ
    2020-12-14 16:46

    this is what did the trick for me:

    mat <- round(matrix(c(0.9, 0.89, 200, 0.045, 2.0), c(1, 5)), 4)
    rownames(mat) <- "$y_{t-1}$"
    colnames(mat) <- c("$R^2$", "$\\bar{x}$", "F-stat", "S.E.E", "DW")
    mat <- xtable(mat)
    print(mat, sanitize.text.function = function(x){x})
    

    This way you avoid the backslash issue in the table text.

提交回复
热议问题