Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subset inconsistent with zoo when 'i' contains NA #414

Open
joshuaulrich opened this issue Feb 6, 2024 · 0 comments
Open

subset inconsistent with zoo when 'i' contains NA #414

joshuaulrich opened this issue Feb 6, 2024 · 0 comments
Assignees
Labels
enhancement Enhancement to existing feature

Comments

@joshuaulrich
Copy link
Owner

xts subset does not allow NA in 'i' like zoo does.

require(xts)
x <- .xts(matrix(1:20, 10, 2), 1:10)
z <- as.zoo(x)
i <- c(1, NA, 5)

z[i,]
##                          
## 1969-12-31 18:00:01  1 11
## 1969-12-31 18:00:05  5 15
## <NA>                NA NA

x[i,]
## Error in `[.xts`(x, i, ) : 
##   only zeros may be mixed with negative subscripts

Making this consistent will not be a breaking change since it is currently an error in xts.

@joshuaulrich joshuaulrich added the enhancement Enhancement to existing feature label Feb 6, 2024
@joshuaulrich joshuaulrich self-assigned this Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing feature
Projects
None yet
Development

No branches or pull requests

1 participant