You can also do it with the following:

 plot(as.POSIXct(strptime(as.character(dat[,2]), "%Y%m%d")), dat[,1])



On 3/5/07, d. sarthi maheshwari <samay.sar@gmail.com> wrote:
>
> Hi,
>
> I want to display dates on my x-axis of the plot. I was trying to use
> plot()
> command for the same and passing the values in following manner:
>
> The variable "dat" is a data frame. The first column has numeric values
> and
> second column has date.
>
> e.g. dat
>
>                 [,1]                        dat[,2]
>
> [1,]            300                       20060101
> [2,]            257                       20060102
> [3,]            320                       20060103
> [4,]            311                       20060104
> [5,]            297                       20060105
> [6,]            454                       20060106
> [7,]            360                       20060107
> [8,]            307                       20060108
> ....
> ....
>
> the command I am performing is::
>
> plot(x=dat[1], y=as.character(dat[2]))
>
>
> Kindly suggest some method by which I can perform my task of displaying
> the
> first column values on y-axis against dates on x-axis.
>
> --
> Thanks & Regards
> Sarthi M.
>
>        [[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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

