r - R to latex:同时清理 % 和 \latexfunction
问题描述
经过一些 R 计算后,我得到了一个如下所示的矩阵:
matrix <- cbind(c(00,01,02),c("some text","random stuff","special characters'"), c("0.12%","\\cellcolor{red!25}3.67%","1.61%"))
我正在尝试将其导出到乳胶,如下所示:
file.name <- "file.name"
file.caption <- "file.caption"
print(xtable(matrix, align = c("l","r","r","r"),
label = paste("tab:", file.name, sep = "", collapse = NULL),
caption = file.caption),
type = "latex",
size="\\normalsize",
caption.placement = "top",
# file = paste("graphs/", file.name, ".tex", sep = "", collapse = NULL),
floating = FALSE,
tabular.environment = "longtable",
sanitize.text.function = function(x) x)
如果我不这样做sanitize
,pdf 将显示“\cellcolor{red!25}”(显然,我更喜欢让单元格着色)。如果我sanitize
因为“%”而无法输入 file.tex。我试过sanitize.text.function = function(x) x
了sanitize.text.function = identity
......没有成功。任何想法?
解决方案
推荐阅读
- keras - DDPG(Deep Deterministic Policy Gradients),actor是如何更新的?
- ios - 没有在深度链接中获得链接
- javascript - ExtJS 4.2 更大的标签关闭图标?
- php - 电子商务跟踪订单日期不匹配问题谷歌分析
- azure-devops - 在 VSTS 中以编程方式添加 ARM 服务端点
- python - 无法在 mac 上训练 hypergan
- mongodb - MongoDB 每月统计空月
- html - BEVM 是有效的还是我们可以单独使用修饰符?
- python - 选择随机节点时出错(Python)
- php - 具有两个图表系列的 Google 图表 (SQL/PHP)