Hi, I'm having trouble getting xtable to print a simple xts object. When the
frequency is 1800 I get an error. However when frequency(x) is reported as 1
it works. I have included example below.
Another question is how can I have the time index printed in place of the row
number?
Thanks for your help,
--
Stergios Marinopoulos
library(xts)
library(xtable)
# This does not work. The indices are 1800 seconds apart.
x = xts(x=rep(pi, 6), order.by=as.POSIXlt( "2014-01-01 06:30:00" ) + 1800 * 0:5
)
print(xtable(x))
print(frequency(x)) # [1] 0.0005555556
# This is the error message:
# Error in rep(NA, start(x)[2] - 1) : invalid 'times' argument
# It works when I make the indices only 1 second apart.
x = xts(rep(pi, 6), as.POSIXlt( "1970-01-01 00:00:00" ) + 0:5 )
print(xtable(x))
print(frequency(x)) # [1] 1
# Here is a daily data example that works.
library(quantmod)
AAPL = getSymbols("AAPL", auto.assign=FALSE, from="2014-01-01", to="2014-01-10")
print(xtable(AAPL), include.rownames=TRUE)
print(frequency(x)) # [1] 1
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.