簡體   English   中英

從LaTeX中R的xtable()表輸出中刪除其他腳注

[英]Remove additional footnote from R's xtable() table output in LaTeX

我正在使用以下R代碼來調用xtable並為Sweave文檔生成一個LaTeX表。

ifelse(LaTeX==1, print(xtable(rule1.results.noTC, caption="Rule 1 Results 0 Transaction Costs",
                          digits=c(1,2,4,4,4), display=c("d","d","f","f","f"))), 
   print(rule1.results))

這將產生以下乳膠

% latex table generated in R 3.0.1 by xtable 1.7-1 package
% Sun Jul 28 16:54:42 2013
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
  \hline
 & L & profits & annCumulExReturn & sharpe \\ 
  \hline
1 &   5 & -888.8215 & -0.1501 & -4.3939 \\ 
  2 &  10 & -909.8941 & -0.1533 & -6.8882 \\ 
  3 &  20 & -893.6245 & -0.1509 & -6.9081 \\ 
  4 &  40 & -865.6764 & -0.1466 & -9.8462 \\ 
  5 &  80 & -832.4700 & -0.1417 & -11.7260 \\ 
  6 & 160 & -757.0690 & -0.1305 & -16.3088 \\ 
  7 & 320 & -626.9162 & -0.1118 & -31.6134 \\ 
  8 & 640 & -340.8740 & -0.0730 & -44.2321 \\ 
   \hline
\end{tabular}
\caption{Rule 1 Results with Transaction Costs} 
\end{table}

當我將其轉換為pdf時,會得到一個漂亮的表格。 但是,其后是一個奇怪的注釋:[1]“

如果我連續繪制多個表,則會得到其中的幾個。 如何通過R的xtable或編輯LaTeX代碼來消除這種情況。

謝謝

沒有您的數據和.tex文件的示例,我不能肯定地說,但是我非常有信心,這是由於您使用了ifelse 我想以下內容不會給您帶來怪異的打印輸出:

if(LaTeX==1) {
    print(xtable(rule1.results.noTC,caption="Rule 1 Results 0 Transaction Costs",
                 digits=c(1,2,4,4,4), display=c("d","d","f","f","f")))
} else {
    print(rule1.results))
}

這是因為ifelse返回其結果,您也正在打印該結果。 參見,例如:

> ifelse(TRUE,print("true"),print("false"))
[1] "true"
[1] "true"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM