I am using the following code to draw a graph and print it to a PDF:
ggplot(agg_data_cl, aes( as.Date(date), avg_entries, color = classification ) ) +
geom_point()
ggsave(file = "output.pdf")
This works fine when I execute the script in TextMate.
But when I call it from the commandline via RScript I get the following error:
Error in all.vars(as.formula(.$facets)) :
could not find function "as.formula"
Calls: print ... <Anonymous> -> <Anonymous> -> <Anonymous> -> all.vars
Execution halted
I use the following header in my RScrpipt file:
#! /usr/local/bin/Rscript --vanilla --default-packages=utils
Any ideas what could be the problem?
Here is my command line session information:
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
In textmate sessionInfo() gives me more attached base packages:
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
I have no idea why this the case.