[R] bwplot with Date object

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Aug 1 00:12:40 CEST 2008


On Thu, Jul 31, 2008 at 12:54 PM, GOUACHE David
<D.GOUACHE at arvalisinstitutduvegetal.fr> wrote:
> Hello R-helpers,
>
> I would like to produce a boxplot for dates, using lattice.
>
> Here is a dummy example :
>
> dates<-as.Date(32768:32895,origin="1900-01-01")
> plouf<-data.frame(days=dates,group=factor(rep(1:2,times=128/2)))
>
> bwplot(group~days,data=plouf)
> # doesn't work, whereas :
> bwplot(group~as.numeric(days),data=plouf)
> # does, but is obviously not good looking when it comes to axis legends...
>
> Is there a way to pull off a boxplot with dates ?

The automatic calculation of tick positions clearly gives less than
useful results. You should be able to supply locations explicitly
using

bwplot(..., scales=list(x = list(at = <...>)) )

-Deepayan



More information about the R-help mailing list