[R] use date as x-axis

From: tom soyer <tom.soyer_at_gmail.com>
Date: Thu 19 Oct 2006 - 02:08:11 GMT


I have the following data in two columns. The first column is the date, the second is data.

Date Data

3-Jan-95 459.21
4-Jan-95 459.13
5-Jan-95 460.73
6-Jan-95 460.38
9-Jan-95 460.67
10-Jan-95 460.9
11-Jan-95 461.68
12-Jan-95 461.64
13-Jan-95 461.64
16-Jan-95 465.97
17-Jan-95 469.38
18-Jan-95 470.05
19-Jan-95 469.72
20-Jan-95 466.95
23-Jan-95 464.78

24-Jan-95 465.81
25-Jan-95 465.86

I would like to used the date as the x-axis and data the y-axis. I tried plot(Data~Date,data=d), where d is the R data frame variable that holds the two columns. But something very strange happened, although the graph has dates on the x-axis, the order of these dates are wrong. I searched the help file, and realized that I need to tell R explicitly to set the date as x-axis. Unfortunately, this is as far as I got, and I couldn't figure out exactly how to do this. Could someone please provide me with an example?



        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Oct 19 12:14:03 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 13:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.