I am a bit confused about how to get the format of the labels in xyplot
to show as dates rather than the numeric value.
e.g.,
x <-
as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y")
y <- c(1,2,3)
plot(y~x) #produces formatted labels
xyplot(y~x) #doesn't give formatted x labels
xyplot(y~x,scales=list(x=list(format="%d/%m/%Y"))) #still doesn't.
How do I get the format for the xlabels ?
Robert
************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.
************************************************************************
[[alternative HTML version deleted]]
On 9 February 2005 at 14:37, Denham Robert wrote:
| I am a bit confused about how to get the format of the labels in xyplot
| to show as dates rather than the numeric value.
|
| e.g.,
|
| x <-
as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y")
| y <- c(1,2,3)
|
| plot(y~x) #produces formatted labels
|
| xyplot(y~x) #doesn't give formatted x labels
|
| xyplot(y~x,scales=list(x=list(format="%d/%m/%Y"))) #still
doesn't.
|
| How do I get the format for the xlabels ?
You need another as.POSIXct():
> x <-
as.POSIXct(as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y"))
> y <- c(1,2,3)
> xyplot(y~x)
Dirk
--
Better to have an approximate answer to the right question than a precise
answer to the wrong question. -- John Tukey as quoted by John Chambers