動的なファイル名で jpeg ファイルを書きたいです。plot_filename
文字列を他の変数の値と連結して、動的なファイル名を作成します。
plot_filename = paste("Series T_all","/",Participant[i],"/",Part[i,2],"/",Part[i,3],".jpg")
plot_filename の出力は、単なる別の文字列です。"Series T_all / 802 / 1 / 64 .jpg"
jpeg()
ただし、この文字列を関数のファイル名として使用したい場合
jpeg(filename= plot_filename, width = 2000, height = 1500, quality = 100,
pointsize = 50)
plot(T1)
dev.off()
次のエラーが表示されます。
Error in jpeg(filename = paste("Series T_all", "/", Participant[i], "/", :
unable to start jpeg() device
In addition: Warning messages:
1: In jpeg(filename = paste("Series T_all", "/", Participant[i], "/", :
unable to open file 'Series T_all / 802 / 1 / 64 .jpg' for writing
2: In jpeg(filename = paste("Series T_all", "/", Participant[i], "/", :
opening device failed
しかし、単純な文字列(貼り付け機能なし)をファイル名として使用するだけの場合
name="plot_filename.jpg"
機能はjpeg()
問題なく動作します。
これがどのように可能か知っている人はいますか?どちらの場合も、関数に文字列を入力しているだけのように思えるjpeg()
ので、一方が機能し、他方が機能しない理由がわかりません。
ありがとう