From Run Document, this line
generates "Warning: Error: order.by requires an appropriate time-based object"
However, as far as I can tell, it runs fine using exactly the same data when I call it having executed the code in the IDE. I set a breakpoint in the .rmd file using browser() which I reach via rmarkdown::run(). Just before this line, the class of dt.vec is "POSIXct" "POSIXt" which seems good. Stepping through in debug mode after calling rmarkdown::run() I don't get the error. I get it when I click Run Document.
My question(s) are how might I debug this? And what might cause code to run will in the IDE but not in rmarkdown::run()? I know I have library(xts) executed. Thanks.