Skip to content

Indexing time series objects

2 messages · Luis Torgo, Dirk Eddelbuettel

#
Hi. I have a question concerning the easiest way to index a time series 
object holding some stock quotes. An example:
My question is:- Suppose I want to know the stock quotes on 2000-01-03. Which 
is the easiest way to index the "ibm" time series object to get them?
I got what I wanted using:
window(ibm,start=julian(as.POSIXct("2000-01-03")),end=julian(as.POSIXct("2000-01-03")))

But I'm sure there is a much better way to get it!

In summary, my problem is to find the easiest way to convert from my 
"natural" way of thinking on the quotes (which is date-based) into the 
indexing schema of time series objects, which by looking at the code of 
"get.hist.quote" is based on the conversion into the number of days (using 
"julian") from an origin.

Thank you for any help.
Luis
#
On Fri, Jun 28, 2002 at 10:18:42AM +0100, Luis Torgo wrote:
[...]
[...]
I don't think there is -- ts() cannot deal that well with "business-daily"
data. It is intended for monthly or quarterly data with regular increments,
or frequency.  Dealing with daily data with weekends and holidays is much
harder. Adrian's solution of converting to Julian and padding with NaN for
non-business days is probably as good as it gets. 

Dirk