[R] Importing Excel/Openoffice Dates into R

Dirk Eddelbuettel edd at debian.org
Fri Jan 2 15:24:37 CET 2004

On Fri, Jan 02, 2004 at 04:29:15PM +0800, Ashley Davies wrote:
> I would like to import some daily financial data from excel via csv. 
> More specifically, I would like to be able to use the ts.union function 
> from the tseries library as the dates are irregular and I need to line 
> up the dates so that I can place all the variables into one data frame.

In short, you cannot. The ts objects require _regular_ time series with
fixed increments or frequencies. This works great for annual, quarterly or
monthly macroeconomic series, but is much more difficult for business-daily
data with weekends, holidays and all that.

What you really want is the its package now on CRAN. It provides an object
for _irregular_ time series', as for example business or market daily
series. You can then subset, join, intersect, ... at will. This uses the
very powerful data arithmetic features which R contains, but shields a lot
of the at-first somewhat intimidating complexity of the datetime objects.
Its is a real gem. And do search the archives for this list. There have been
many usage examples for its, often provided directly by the most helpful
author of its, and some contain examples starting from csv files.

Good luck,  Dirk

The relationship between the computed price and reality is as yet unknown.  
                                             -- From the pac(8) manual page

More information about the R-help mailing list