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.ts throws error when passed a mts #64

Closed
joshuaulrich opened this issue Feb 26, 2015 · 0 comments
Closed

as.xts.ts throws error when passed a mts #64

joshuaulrich opened this issue Feb 26, 2015 · 0 comments
Assignees
Labels

Comments

@joshuaulrich
Copy link
Owner

as.xts.ts uses length(x) to create the sequence of dates for the index, which returns the number of elements for a matrix (not the number of rows).

Reproducible example from stackoverflow: Use dygraph for R to plot xts time series by year only?

require(xts)
winners <- data.frame(year=1966:1971,
  mensec=c(8231, 8145, 8537, 8029, 7830, 8325),
  womensec=c(12100, 12437, 12600, 12166, 11107, 11310))
men <- ts(winners$mensec, frequency = 1, start=winners$year[1])
women <- ts(winners$womensec, frequency = 1, start=winners$year[1])
both <- cbind(men, women)
as.xts(both)
# Error in xts(x.mat, order.by = order.by, frequency = frequency(x), ...) : 
#   NROW(x) must match length(order.by)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant