2016-12-06 10 views
1

Rスクリプトからsweaveを実行します。 Rnwファイルはプロジェクトディレクトリのすぐ下のRnwディレクトリにあります。私はこれを試しましたRスクリプトからRを実行する(Rnw)ファイル

system("Rnw/compilePDF.Rnw") 

そして、この応答を得ました。

sh: Rnw/compilePDF.Rnw: Permission denied 

.Rnwファイルのアクセス許可は-rw-r-r--ですが、問題ではないと思われます。

答えて

1

解決策は、次のコードを含めることです。 SweaveのデフォルトはASCIIで、このエフェクトにエラーを返すため、エンコーディングが必要です。

Sweave("Rnw/compilePDF.Rnw", encoding = "UTF-8") 

コマンドの出力は

Writing to file compilePDF.tex 
Processing code chunks with options ... 

You can now run (pdf)latex on ‘compilePDF.tex’ 

を使用し、PDFにこれを変換することです

tools::texi2pdf("Rnw/compilePDF.tex") 
関連する問題