54

そんなこと知ってる

 pdf("myOut.pdf")

RでPDFに印刷されます。

  1. PDFファイルの新しいページ(最後に追加)に後続のグラフを印刷するループを作成しますか?

  2. 後続のグラフを新しいPDFファイルに出力するループを作成しますか(ファイルごとに1つのグラフ)?

4

3 に答える 3

61

ヘルプ(pdf)はご覧になりましたか?

使用法:

 pdf(file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"),
     width, height, onefile, family, title, fonts, version,
     paper, encoding, bg, fg, pointsize, pagecentre, colormodel,
     useDingbats, useKerning)

引数:

file: a character string giving the name of the file. For use with
      'onefile=FALSE' give a C integer format such as
      '"Rplot%03d.pdf"' (the default in that case). (See
      'postscript' for further details.)

1) の場合、onefile をデフォルト値の TRUE のままにします。複数のプロットが同じファイルに入ります。

2) の場合、onefile を FALSE に設定し、C 整数形式のファイル名を選択すると、R が一連のファイルを作成します。

于 2009-09-08T18:11:21.160 に答える
42

わかりません。

同じファイルに追加 (1 ページに 1 つのプロット):

pdf("myOut.pdf")
for (i in 1:10){
  plot(...)
}
dev.off()

各ループの新しいファイル:

for (i in 1:10){
  pdf(paste("myOut",i,".pdf",sep=""))
  plot(...)
  dev.off()
}
于 2009-09-08T18:10:13.033 に答える
1
pdf(file = "Location_where_you_want_the_file/name_of_file.pdf", title="if you want any")
plot() # Or other graphics you want to have printed in your pdf
dev.off()

pdf で必要なだけ多くのものをプロットできます。プロットは、異なるページの pdf に追加されます。dev.off() はファイルへの接続を閉じ、pdf が作成され、次のようになります。

> dev.off()
null device 1
于 2016-01-26T12:26:04.440 に答える