ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

More flexible `date_breaks` arg or better doc ?

Open moodymudskipper opened this issue 3 years ago • 0 comments

The date_breaks arg is documented as :

date_breaks :

A string giving the distance between breaks like "2 weeks", or "10 years". If both breaks and date_breaks are specified, date_breaks wins.

I tried date_breaks = "15 minutes" and got :

Error in cut.POSIXt(date, time, right = TRUE, include.lowest = TRUE) : invalid specification of 'breaks'

It worked with date_breaks = "15 min" though.

Looking at the code it seems to fall back to cut.POSIXct and we see in the doc the breaks arg described as :

[...] or an interval specification, one of "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year", optionally preceded by an integer and a space, or followed by "s". (For "Date" objects only interval specifications using "day", "week", "month", "quarter" and "year" are allowed.)

Maybe the doc could mention those (or refer to ?cut.POSIXt) and/or the error could be improved ?

moodymudskipper avatar Aug 29 '22 08:08 moodymudskipper