[R] Newbie question - handling dates as x-axis variable

Michael Mastroianni mjmalpha at localnet.com
Fri Sep 22 16:44:11 CEST 2000


Hi, all.  Please forgive my ignorance
as I'm just beginning to investigate
R for use in my company as a primary
analytical tool ...

I have data which I've read into a data frame
with the following command:

mkt <- read.csv("h:/qdamrtm.csv",header=T)

I'd like to investigate the relationship(s)
(or lack thereof) between the given variables,
and have developed a variety of plots that
really make me appreciate how powerful
R is, even when applied in a very rudimentary
fashion.

My question is, is there an elegant way to
treat the date data such that I can plot
variables against x-axis date labels, specify
ranges of dates, and calculate differences
between dates ?  I am beginning to look
at the packages like "chron" and time series
information now.  The workaround I've adopted
merely uses the row index of the data frame
as the x-axis variable, and I've "pasted" the
start and end dates into the x-axis title to
associate the plotted indices with a date
range (which is a bit of a kludge, I think).

If I've gleaned anything at all from the R
documentation, I should be trying to
treat my data frame as an object to be
manipulated, and should be able to
develop functions or procedures which
allow me to handle dates in a simple
and direct manner.

Any advice/guidance/tips are much appreciated
as I have *tons* of this kind of data to
cut my teeth on ...

(Also, kudos to the R developers: what
an incredible job in creating a "numerical
laboratory" environment.  I'm especially
pleased that I can investigate R in a
Windows environment knowing that it's
available as we move to Linux ...)

Thanks in advance for any help --

Mike Mastroianni
==================================
For reference, the CSV data looks like this:

"WKDAY","HR","DAYT","DAMMKT","RTMMKT"
"Fri",0,"01/07/00",16.16,17.51
"Fri",0,"01/14/00",21.91,51.15
"Fri",0,"01/21/00",31.25,21.38
"Fri",0,"01/28/00",36.01,41.77
"Fri",1,"01/07/00",15.24,15.32
"Fri",1,"01/14/00",20.23,31.48
"Fri",1,"01/21/00",30.40,12.98
"Fri",1,"01/28/00",28.27,38.86
....
"Wed",23,"08/23/00",23.11,39.99
"Wed",23,"08/30/00",46.48,58.77
"Wed",23,"09/06/00",32.63,9.09
"Wed",23,"09/13/00",44.11,44.89



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list