[R] barplot with chopped bars
Jim Lemon
jim at bitwrit.com.au
Wed Sep 23 03:14:10 CEST 2009
On 09/23/2009 09:24 AM, Lars Skjærven wrote:
> Great. Thanks for a quick reply. That will work I guess. Although, can I use
> float values instead of dates?
> so that the "gantt.info" starts and end values are floats instead of dates?
> or will I have to work around this ?
>
Hi Lars,
Try this for times:
ginfo<-list(
labels=c("Jim","Joe","Jim","John","John","Jake","Joe","Jed","Jake"),
starts=as.POSIXct(strptime(c("2009-09-23 08:10:00",
"2009-09-23 08:25:00","2009-09-23 13:10:00","2009-09-23 08:00:00",
"2009-09-23 14:10:00","2009-09-23 09:03:00","2009-09-23 12:33:00",
"2009-09-23 09:00:00","2009-09-23 13:17:00"),
format="%Y-%m-%d %H:%M:%S")),
ends=as.POSIXct(strptime(c("2009-09-23 12:30:00",
"2009-09-23 11:47:00","2009-09-23 17:02:00","2009-09-23 13:14:00",
"2009-09-23 16:57:00","2009-09-23 12:39:00","2009-09-23 17:21:00",
"2009-09-23 17:00:00","2009-09-23 16:19:00"),
format="%Y-%m-%d %H:%M:%S")))
gantt.chart(ginfo,vgrid.format="%H:%M:%S",main="Time at work")
For non-date/time x values, yes, some modification will be needed as the
function expects time values. Shouldn't be too hard.
Jim
More information about the R-help
mailing list