Loris Bennett <loris.benn...@fu-berlin.de> writes: > Hi, > > I have a list of dates like this: > > date > 2009-12-03 > 2009-12-11 > 2009-10-07 > 2010-01-25 > 2010-01-05 > 2009-09-09 > 2010-01-19 > 2010-01-25 > 2009-02-05 > 2010-01-25 > 2010-01-27 > 2010-01-27 > ... > > and am creating a histogram like this > > t <- read.table("test.dat",header=TRUE) > hist(as.Date(t$date), "years", format = "%d/%m/%y", freq=TRUE) > > However, I would rather not label the breaks themselves, but instead > print the date with the format "%Y", between the breaks. > > Is there a simple way of doing this? > > Regards > > Loris > > -- > Dr. Loris Bennett > ZEDAT Computer Centre > Freie Universität Berlin > Berlin, Germany > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
With a little help from a chap called Jim who doesn't seem to have replied to the list, I looked discovered 'axis' and came up with this: > hist(as.Date(t$date),"years",format="%Y",freq=TRUE,xaxt="n") In hist.default(unclass(x), unclass(breaks), plot = FALSE, ...) : argument '...' is not made use of > axis(1,at=as.Date(c("2009-07-01","2010-07-01")), labels=c("2009","2010"),lwd=0,lwd.ticks=0) I don't know what to make of the warning but the labels are placed as I want. Loris -- Dr. Loris Bennett ZEDAT Computer Centre Freie Universität Berlin Berlin, Germany ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.