[R] Help with Dates

Hans-Peter gchappi at gmail.com
Mon Jul 23 19:38:43 CEST 2007


> I am taking an excel dataset and reading it into R using read.table.
> (actually I am dumping the data into a .txt file first and then reading data
> in to R).

If you are on *windows* you could also try my xlsReadWrite package
which contains some datetime functions. Exceldates (e.g. formatted as
dd-mmm-yy) can be read as COleDateTime (floating point) values or as
character strings.  The first one is preferable imo as it avoids a
typecast and it is the type commonly used in OLE automation.

> But how can I subset for multiple periods e.g 00- 05?

Floating point numbers dates can be converted to year-strings with
dateTimeToStr( value, "yy" ) and then subset as shown in a previous
post. The (paid) pro version contains many more date functions, e.g.
yearOf. Details see
http://treetron.googlepages.com/xls.oledatetimeex.html.

-- 
Regards,
Hans-Peter



More information about the R-help mailing list