Here is the code:
require("quantmod")
getSymbols("GLD")
getSymbols("SLV")
getSymbols("TLT")
GSR = GLD/SLV
par(mfrow=c(2,2))
chartSeries (GLD, subset="2010", TA = NULL)
chartSeries (SLV, subset="2010", TA = NULL)
chartSeries (TLT, subset="2010", TA = NULL)
chartSeries (GSR, subset="2010", TA = NULL)
When I run this file from TextMate with the Command R keystroke, I get four charts lined up in a 2 x 2 grid, as you'd expect from the par() function. When I source this from the R console,
> source("~/myChartSeries.r")
I get a flash of each chart with the last one depicted alone. The last I'd heard, chartSeries() was not compliant with the par() function but chart_Series() is. So the behavior of the console is not surprising. But why does execution from TextMate work? Has chartSeries() been made par() compliant and is the R console execution flawed?
When the code is run from TextMate, it prints all four charts separately with the 'illusion' that it is a single chart with four panels. In fact, when I comment out the par() function,
#par(mfrow=c(2,2))
I get the same result. So it appears that chartSeries() is still not par() compliant.