You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The start and end arguments to window.xts do not support NA the same as if they were NULL.
Inside window_idx() the arguments are passed through .toPOSIXct() which will fail if they are logical (default) NA. However, the start/end arguments are later passed into the index_bsearch() function which does check if start/end are NA.
Treat start or end NA the same as if they were NULL.
Minimal, reproducible example
x=xts::xts(1:10, as.POSIXct('2020-1-1') +1:10)
window(x, start=as.POSIXct('2020-1-1'), end=NA)
# Error in .toPOSIXct(end, tzone(x)) : invalid time / time based class
Will you accept a pull request to window.xts (via index_bsearch) to modify the behavior to allow NA to the start/end arguments to be interpreted the same as NULL values?
This is a good suggestion. Would you still be willing to create a PR?
We should add tests to ensure that the behavior of window.xts() matches window.zoo() in these cases. I'd really appreciate it if you added those in the PR.
Description
The start and end arguments to window.xts do not support NA the same as if they were NULL.
Inside window_idx() the arguments are passed through .toPOSIXct() which will fail if they are logical (default) NA. However, the start/end arguments are later passed into the
index_bsearch()
function which does check if start/end are NA.Expected behavior
Treat start or end NA the same as if they were NULL.
Minimal, reproducible example
Session Info
The text was updated successfully, but these errors were encountered: