3

私はlatexとknitrを初めて使用し、echo=FALSEを使用するとRチャンクからの出力に問題があります。以下の.Rnwコードは期待どおりに機能します。つまり、出力には次のようになります。

    1. some code
    2. a block of figures arranged 2 x 3
    3. some more code
    4. a block of figures arranged 2 x 3

ただし、チャンクの開口部を変更して、出力からコードブロックを削除します

<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=FALSE>>=

出力からコードを削除するだけでなく(good)、par()設定をオーバーライドして、2つの図(それぞれ2 x 3)がページ上で隣接して配置され、2番目の図のほとんどが端から外れるようにします。

単にコードを出力に残す以外に、どうすればこれを回避できますか?

ありがとう

B

\newpage
<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=TRUE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.mas[,i], xlab="", las=1,
    main=paste(sep="", "bg.mas[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))

par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.rma[,i], xlab="", las=1,
    main=paste(sep="", "bg.rma[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))
@
4

1 に答える 1

1

最も簡単な解決策は、それらを別々のチャンクに分割することです。

<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=FALSE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.mas[,i], xlab="", las=1,
    main=paste(sep="", "bg.mas[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
@

<<bghist2_mas_rma_2, fig.height=4, fig.width=6, echo=FALSE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.rma[,i], xlab="", las=1,
    main=paste(sep="", "bg.rma[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))
@
于 2012-09-14T12:39:53.420 に答える