The main question is when I start R.
What is the main difference when I get an R script against executing it? I am trying to run ggplot2 example scripts.
library("ggplot2") d = data.frame(x1=c(1,3,1,5,4), x2=c(2,4,3,6,6), y1=c(1,1,4,1,3), y2=c(2,2,5,3,5), t=c('a','a','a','b','b'), r=c(1,2,3,4,5)) ggplot() + scale_x_continuous(name="x") + scale_y_continuous(name="y") + geom_rect(data=d, mapping=aes(xmin=x1, xmax=x2, ymin=y1, ymax=y2, fill=t),color="black",alpha=0.5) + geom_text(data=d, aes(x1+(x2-x1)/2,y=y1+(y2-y1)/2, label=r), size=4) + opts(title="geom_rect", plot.title=theme_text(size=40, vjust=1.5))
When I use this script, the graphs are not displayed. I understand that this is due to the lack of an explicit print statement in my code. I read the discussion that when executing a command in an interactive shell, the print statement is implicit.
My question is this: when I run the script vs source, what is the main difference? When will I do one on top of the other? Thanks!