Reputation: 5807
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")
Upvotes: 4
Views: 3651
Reputation: 13465
Year of first entry....
format(index(first(AAPL)),"%Y")
Year of last entry...
format(index(last(AAPL)),"%Y")
Upvotes: 4