r - quantmod::chartSeries does not plot all components -
i have read quite lot of r docs, can't find recognized answer this. forehead sore banging against desk. ;)
this specific library(quantmod)
, because trying learn, suppose general question too.
r 2.12.2 gui 1.36 leopard build 64-bit (5691) mac os x 10.6.6
i trying replicate behaviour of quantmod
example @ http://www.quantmod.com/examples/intro/
from gui, - below generates chart http://www.quantmod.com/examples/intro/aapl-full.png:
> require(ttr) > getsymbols("aapl") [1] "aapl" > chartseries(aapl) > addmacd() > addbbands()
but when source()
.r file gui, chart for
> chartseries(aapl)
that is, price chart , volume chart underneath it. further, if try following command line kind of works expected.
$ r --no-save `<`quantmod.r
a file called rplots.pdf
generated, contains 3 pages. third page contains price + volume + macd + bollinger bands.
what quantmod
doing make life difficult? or not understand blindingly obvious , making life difficult?
what have sourced script able use addmacd()
, addbbands()
functions chart?
as side question, data generated addmacd()
, addbbands()
stored?
after reading through quantmod docs , before banging head against desk, try searching r-sig-finance mailing list archives (one way via "support lists" tab on rseek.org). question has come several times on list.
to answer main question, see "note" section of ?ta
:
calling of above methods within function or script require them wrapped in ‘plot’ call rely on context of call initiate actual charting addition.
so should change example to:
> require(ttr) > getsymbols("aapl") [1] "aapl" > chartseries(aapl) > plot(addmacd()) > plot(addbbands())
to answer side question, see "value" section of ?chartseries
, along help("chob-class")
, help("chobta-class")
.
Comments
Post a Comment