I am wondering how I can change date format.
The code I am working on is following:
library(quantmod)
getSymbols("AAPL")
price_AAPL <- AAPL[,6]
plot(price_AAPL, main = "The price of AAPL")
This results
I want to alter date format from
"%m %d %Y"
as shown in the graphic to
"%b-%d-%Y"
So I tried following after searching some tips:
plot(price_AAPL, main = "The price of AAPL", xaxt="n")
axis.Date(1,
at=seq(head(index(price_AAPL),1),
tail(index(price_AAPL),1), length.out=5),
format="%b-%d-%Y", las=2)
But this doesn't help, and doesn't even show any labeling on x-axis. I suppose that I might did something wrong with "axis.Date()".
Can anybody help me?