Closed avrenli2 closed 2 years ago
When I run the following code, the index of the xts object includes both date and time of day.
I would like the index of the xts object to only include the date; and not time of day.
library(quantmod) xts() -> HISTORY c("SBUX","TSLA","CAKE") -> STOCKS for (SYMBOL in STOCKS) { getSymbols(SYMBOL , from="2017-1-1" , to="2022-1-1" , auto.assign=F) -> PRICE monthlyReturn(PRICE[,6]) -> RETURNS cbind(HISTORY,RETURNS) -> HISTORY } STOCKS -> colnames(HISTORY) head(HISTORY)
[Insert your sessionInfo() output]
The index has a time because you create HISTORY <- xts() and the default index for xts objects has a time. Set HISTORY <- NULL instead.
HISTORY <- xts()
HISTORY <- NULL
Description
When I run the following code, the index of the xts object includes both date and time of day.
Expected behavior
I would like the index of the xts object to only include the date; and not time of day.
Minimal, reproducible example
Session Info