I download time-series data from MSCI: MSCI-daily. I found that the dates are not properly formatted, so I need to deal with it. I use this code to dealing with data-time:
daily$Date <- daily$Date %>% as.Date(format = "%b %d, %Y")
for(i in 2:7){
daily[,i] <- gsub(daily[,i], pattern = ",", replacement = "") %>% as.numeric()
}
daily <- xts(daily[,-1], order.by = daily[,1])
But it just appear this line:
Error in xts(daily[, -1], order.by = daily[, 1]) :
'order.by' cannot contain 'NA', 'NaN', or 'Inf'
Can anyone help me fix this error in r-studio?