Skip to content
Back to formatted view

Raw Message

Message-ID: <4007DFB5.27124.ED4E1F@localhost>
Date: 2004-01-16T11:57:25Z
From: PIKAL Petr
Subject: Using dates for plotting
In-Reply-To: <20040116110143.GA15498@sesame.kyb.local>

Hi

On 16 Jan 2004 at 12:01, Christoph Lange wrote:

> 
> Dear R-Users!
> 
> I have the following data:
> 
> > runs
> dates kms
> 1 2004-01-15 12:00:00   9
> 2 2004-01-16 12:00:00  10
> 3 2004-01-17 12:00:00   5
> > class(runs$dates)
> [1] "POSIXt"  "POSIXct"
> > 
> 
> Is it possible to _easily_ plot these data with real dates shown as
> tick marks on the x-axis? Perhaps even when the days are not
> continuous but with missing days in between?

plot(dates,kms)

should work, but you need to do some formating (maybe with 
axes=F and axis())

see ?strptime

and to convert your dates to POSIXct gformat
					 ^^
Beware "dates" is a function name in library chron.

HTH Petr

> 
> Thanks in advance,
> 
>   Christoph.
> 
> -- 
> Christoph Lange
> MPI fuer biologische Kybernetik  |Phone: +49-7071-601-607|
> Postfach 2169, D-72012 Tuebingen |FAX:   +49-7071-601-616|
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz