2016-11-01 6 views
0

から右TeX出力を取得できません: これはknitrドキュメント私はxtable Rパッケージに正しいTeX出力を得ることができなかったxtable Rパッケージ

attr(p_val_table_list, "subheadings") <- paste0("Hemisphere : ",c("Left","Right")) 
    xtablelist <- xtableList(p_val_table_list) 
    col.names <- c("KS test","MWU test", "Welch's t-test") 
    rowcom <- list(pos = c(4), 
    command = paste0(c("Region",paste0(" & \\multicolumn{3}{c}{", col.names , '}', collapse='')), '\\\\')) 
    #print(addtorow) 
    print(xtablelist, add.to.row = rowcom, only.contents=FALSE, 
    include.rownames=TRUE, sanitize.colnames.function = simp.colnames, 
    type="latex",floating.environment = "sidewaystable") 

これのチャンクでRコードですTeXのファイルに対応する出力されます。

% latex table generated in R 3.2.3 by xtable 1.8-2 package 
% Mon Oct 31 21:55:14 2016 
\begin{sidewaystable}[ht] 
\centering 
\begin{tabular}{rlllllllll} 
    \hline 
& two.sided & less & greater & two.sided & less & greater & two.sided & less & greater \\ 
    \hline 
\multicolumn{9}{l}{Hemisphere : Left}\\ 
normal vs aMCI & $<$0.0001 & 0.2541 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs amdMCI & $<$0.0001 & 0.8165 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs nMCI & $<$0.0001 & 0.8951 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs nmdMCI & $<$0.0001 & $<$0.0001 & 0.1294 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 \\ 
    aMCI vs amdMCI & $<$0.0001 & 0.8959 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    aMCI vs nMCI & $<$0.0001 & 0.252 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    nMCI vs nmdMCI & $<$0.0001 & $<$0.0001 & 0.7627 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 \\ 
    \hline 
\multicolumn{9}{l}{Hemisphere : Right}\\ 
normal vs aMCI1 & $<$0.0001 & 0.2541 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs amdMCI1 & $<$0.0001 & 0.8165 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs nMCI1 & $<$0.0001 & 0.8951 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    normal vs nmdMCI1 & $<$0.0001 & $<$0.0001 & 0.1294 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 \\ 
    aMCI vs amdMCI1 & $<$0.0001 & 0.8959 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    aMCI vs nMCI1 & $<$0.0001 & 0.252 & $<$0.0001 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 \\ 
    nMCI vs nmdMCI1 & $<$0.0001 & $<$0.0001 & 0.7627 & $<$0.0001 & 1 & $<$0.0001 & $<$0.0001 & 1 & $<$0.0001 \\ 
    \hline 
\multicolumn{9}{l}{}\\ 
\end{tabular} 
\end{sidewaystable} 

...地域&複数列を含むコマンドは、TeX出力を見ていません。 これは私にとってxtableListを使用しているのでしょうか?

答えて

0

私はxtable著者デビッド・スコットからの私の質問に電子メールを受け取った:

私はあなたがxtableListを使用している見ることが嬉しいです。 add.to.rowには問題があります。なぜなら、xtableListは、 にadd.to.rowを使用して中間の見出し(小見出し)を提供するためです。

は、だから私は彼の提案に従うことによって、この問題を回避することができました:はSweave/knitrチャンクと使用文字列置換用 使用as.isがrowcom $ atコマンド文字列を挿入します。 print.xtableListの引数は関数の内部で使用されるため、使用しないでください。

関連する問題