After getting data as a dplyr tibble, the first thing you might want to do is convert it into a time-series (xts) object. Here’s the recommended way:
indices <- Indices() #for IndiaGsecTimeSeries ycInd <- indices$IndiaGsecTimeSeries() %>% filter(NAME == "5_10" & TIME_STAMP >= startDate) %>% select(TIME_STAMP, YIELD = YTM) %>% collect() %>% mutate(TIME_STAMP = as.Date(TIME_STAMP)) ycIndXts <- xts(ycInd$YIELD, ycInd$TIME_STAMP)
Just in case the above code snippet doesn’t render properly:
The mutate has to come after the collect. Otherwise, mutate ends up running as an SQL query in the database and TIME_STAMP remains a string.
Questions? slack me!