How can I get for example the year of the first or last entry in a xts time series object as a string? In this example of the AAPL time series?
require(quantmod)
getSymbols("AAPL")
Year of first entry....
format(index(first(AAPL)),"%Y")
Year of last entry...
format(index(last(AAPL)),"%Y")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With