次のコードを使用してグラフを描画し、PDF に出力しています。
ggplot(agg_data_cl, aes( as.Date(date), avg_entries, color = classification ) ) +
geom_point()
ggsave(file = "output.pdf")
TextMate でスクリプトを実行すると、これは正常に機能します。
しかし、RScript を介してコマンドラインから呼び出すと、次のエラーが発生します。
Error in all.vars(as.formula(.$facets)) :
could not find function "as.formula"
Calls: print ... <Anonymous> -> <Anonymous> -> <Anonymous> -> all.vars
Execution halted
RScrpipt ファイルで次のヘッダーを使用します。
#! /usr/local/bin/Rscript --vanilla --default-packages=utils
何が問題になる可能性がありますか?
これが私のコマンドラインセッション情報です:
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] grid utils base
other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.5.2
loaded via a namespace (and not attached):
[1] grDevices_2.13.1 graphics_2.13.1 stats_2.13.1
textmate sessionInfo() では、添付された基本パッケージがさらに提供されます。
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
なぜこれが当てはまるのか、私にはわかりません。