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

Set index functions should copy index attributes #305

Closed
joshuaulrich opened this issue Aug 4, 2019 · 0 comments
Closed

Set index functions should copy index attributes #305

joshuaulrich opened this issue Aug 4, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@joshuaulrich
Copy link
Owner

The index setting functions, index<-.xts() and .index<-.xts() should always copy the index attributes from x. As of 566ac0d, .index<-.xts() errors (see #297), and index<-.xts() sets the attributes in a non-standard order.

x <- y <- .xts(1:3, 1:3, tzone = "UTC")
attributes(index(x))
# $tclass
# [1] "POSIXct" "POSIXt" 
#
# $tzone
# [1] "UTC"
#
# $class
# [1] "POSIXct" "POSIXt" 
index(y) <- .POSIXct(4:6, "UTC")
attributes(index(y))
# $tzone
# [1] "UTC"
#
# $tclass
# [1] "POSIXct" "POSIXt" 
#
# $class
# [1] "POSIXct" "POSIXt" 
.index(y) <- 4:6
attributes(index(y))
# Error in index.xts(y) : unsupported 'tclass' indexing type
@joshuaulrich joshuaulrich added this to the 0.12-0 milestone Aug 4, 2019
@joshuaulrich joshuaulrich self-assigned this Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant