Message-ID: <681d07c20802130517vecf18d5te922433e3e0d4577@mail.gmail.com>
Date: 2008-02-13T13:17:16Z
From: icosa atropa
Subject: timeseries - xst vs. dataframe?
I've enjoyed your prosthelytizing of xts of late... the syntax you
just highlighted looks appealing. I've found zoo powerful, and xts
appears to be a useful extension.
One question r.e. xts vs. dataframes: the lack of $a and [["a"]]
notation in zoo has always struck me as a cumbersome difference from
dataframes. Is "list" syntax planned for inclusion in xst? At
present, column numbering (test.zoo[,1]) seems the best alternative.
Since as.data.frame(test.zoo)$a appears to recover the core data, it
sounds sensible for "test.zoo$a" to extract an object containing the
index and the named column. Does this break anything?
e.g. :
test.df = data.frame(a=1:5, b=2*(1:5))
test.df$a
#[1] 1 2 3 4 5
index = Sys.time() + 60*1:5
test.zoo = zoo(test.df, order.by=index)
test.zoo$a
#NULL
test.zoo[1:2,1]
# 2008-02-13 05:54:40 2008-02-13 05:55:40
# 1 2
coredata(test.zoo)$a
#NULL
as.data.frame(test.zoo)$a
# [1] 1 2 3 4 5
thanks and best,
christian
> At this point 'xts' objects behave much like any standard data.frame, matrix or, most closely, zoo object. They have some unique user 'xts' methods but all standard 'zoo' methods will work (it just extends 'zoo')