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

as.xts() error when order.by is POSIXlt #194

Closed
joshuaulrich opened this issue Jun 24, 2017 · 0 comments
Closed

as.xts() error when order.by is POSIXlt #194

joshuaulrich opened this issue Jun 24, 2017 · 0 comments
Assignees
Labels

Comments

@joshuaulrich
Copy link
Owner

Looks like this is caused by the check added for #173.

DFX <- structure(list(DateTime = structure(list(sec = c(0, 0, 0), min = c(10L, 0L, 5L),
  hour = c(17L, 18L, 18L), mday = c(24L, 24L, 24L), mon = c(5L, 5L, 5L),
  year = c(114L, 114L, 114L), wday = c(2L, 2L, 2L), yday = c(174L, 174L, 174L),
  isdst = c(1L, 1L, 1L), zone = c("EDT", "EDT", "EDT"), gmtoff = c(NA_integer_,
  NA_integer_, NA_integer_)), .Names = c("sec", "min", "hour", "mday", "mon", "year",
  "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", "POSIXt")),
  Open = c(125.03, 125.34, 125.85)), .Names = c("DateTime", "Open"), class = "data.frame",
  row.names = 558:560)
DFX <- as.xts(DFX[, -1], order.by = DFX$DateTime)
# Error in is.finite(order.by) : 
#   default method not implemented for type 'list'
@joshuaulrich joshuaulrich self-assigned this Jun 24, 2017
@joshuaulrich joshuaulrich added this to the Release 0.10-0 milestone Jun 25, 2017
joshuaulrich added a commit that referenced this issue Jun 26, 2017
The check for finite index values was very early in the xts
constructor, which could cause problems if order.by wasn't strictly
a numeric vector (e.g. if it was POSIXlt--a list). This was to ensure
the index doesn't contain +/-Inf, NA, or NaN (see #173).

Move the check until after the index has been converted to
POSIXct/numeric, so we can be certain it is a numeric vector.

Fixes #194.
joshuaulrich added a commit that referenced this issue Jun 26, 2017
The check for finite index values was very early in the xts
constructor, which could cause problems if order.by wasn't strictly
a numeric vector (e.g. if it was POSIXlt--a list). This was to ensure
the index doesn't contain +/-Inf, NA, or NaN (see #173).

Move the check until after the index has been converted to
POSIXct/numeric, so we can be certain it is a numeric vector.

Fixes #194.
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