我正在尝试在表格顶部添加标题,并附上表格编号和名称。我已经尝试将caption ='TEST'与caption.placement ='TOP'
<<include=F>>=
rown <- c(
'Coefficient'
, 'SAT Comp'
, 'Incoming GPA'
, 'Incoming Units'
)
df <- cbind(
rown
, as.data.frame(store1$coefficients)
)
coln <- paste(
""
, "Estimate"
, "Std. Error"
, "$t$-Stat"
, "$p$-Value"
, sep = " & "
)
hline <- c(0)
htype <- c(
paste0(paste0(coln, "\\\\"), "\n")
)
cap <- 'TEST'
x_df <- xtable(df)
@
<<include=T, echo=F, results='asis'>>=
print.xtable(x_df
, caption = 'TEST'
, caption.placement = 'top'
, add.to.row = list(
pos = as.list(hline)
, command = htype
)
, include.colnames = F
, include.rownames = F
, sanitize.text.function = function(x){x}
, sanitize.colnames.function = function(x){x}
, sanitize.rownames.function = function(x){x}
)
@
我编译时标题根本没有出现。