[R] RE : bwplot with Date object

GOUACHE David D.GOUACHE at arvalisinstitutduvegetal.fr
Fri Aug 1 16:50:06 CEST 2008


I ended up finding one solution to my 2nd question.
Here it is :
 
http://tolstoy.newcastle.edu.au/R/help/04/01/0649.html
 
Sorry for the bother.
 
David

________________________________

De: GOUACHE David
Date: ven. 01/08/2008 15:50
À: Deepayan Sarkar
Cc: r-help at stat.math.ethz.ch
Objet : RE : [R] bwplot with Date object


Hello and thank you for your reply.
My dummy example was a bit too simple... I'm having difficulty correctly specifying the 'at' component since my real situation concerns a multipanel display with ' relation="free" '.

To illustrate :

dates<-as.Date(32768:32895,origin="1900-01-01")
plouf<-data.frame(days=dates,group=factor(rep(1:2,times=128/2)))
plouf$group2<-factor(rep(1:2,each=2))
plouf$days[plouf$group2=="2"]<-plouf$days[plouf$group2=="2"]+50
bwplot(group~as.numeric(days)|group2,data=plouf,scales=list(x=list(at=mean(x),relation="free")))

I would have liked one tick at the mean of the x values in each panel... Which isn't what I obtain. How do I customize the location of the tick marks for each panel ?

Thanks again.

David

________________________________

De: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com]
Date: ven. 01/08/2008 00:12
À: GOUACHE David
Cc: r-help at stat.math.ethz.ch
Objet : Re: [R] bwplot with Date object



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