R Sweave:从 tabular 创建 tabularx;如何使用打印?

R Sweave: Create tabularx from tabular; How to use print?

[已解决]

目的是从 tabular table 生成 tabularx table。但是我现在不知道如何为此目的使用 print,因为 print 在创建 tabularx 之前将 table 打印到 PDF 文件。

代码:

t <- read.csv("CSV-Path", header = T, na.strings = c(""), sep = ",")
xT <- xtable(t)
xTx <- strsplit(print(xT, size="\tiny", caption.placement = "top", include.rownames=FALSE, floating=FALSE), "\n")
xTx <- unlist(xTx)
xTx[4] <- gsub("l", "X", xTx[4])
xTx[4] <- gsub("tabuXar", "tabularx", xTx[4])
xTx[14] <- gsub("tabular", "tabularx", xTx[14])

问题是 table 打印在第 3 行。但是我需要使用打印来生成真正的表格 table 以便可以创建 tabularx。

将变量 xTx 保存为 txt.-file 并使用 LaTeX 加载解决了问题。