[R] Displayed Date Format in Plot Title.

Sam Albers tonightsthenight at gmail.com
Fri Apr 13 20:43:40 CEST 2012


Hello all,

I can't seem to figure out how to format a date as a title. I have
something like this:

plot(x=1:10, y=runif(10,1,18), main=paste(as.Date("2011-05-03",
format="%Y-%m-%d")))

## When I would really like this
plot(x=1:10, y=runif(10,1,18), main=paste("May-03-2011"))

## I thought to try this but that produces an NA.
plot(x=1:10, y=runif(10,1,18), main=paste(as.Date("2011-05-03",
format="%Y-%b-%d")))

How do folks usually accomplish something like this?

Thanks so much in advance!

Sam



More information about the R-help mailing list