Dear all Did anybody tried to do time management graphs in R? I could do some aggregation xtabs(duration~person+Typ, data=temp) but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. library(ggplot2) p<-ggplot(temp, aes(x=time, y=Typ, colour=person)) p+geom_line() If anybody can focus me to proper functions or packages I would be greatful. Here are the data. temp <- structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x"), class = "factor"), Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, 6L, 7L, 4L, 4L), .Label = c("A", "B", "C", "D", "E", "F", "G", "H"), class = "factor"), person = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("One", "Two"), class = "factor"), time = structure(c(1435038600, 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, 1435062000, 1435065600, 1435068000), class = c("POSIXct", "POSIXt"), tzone = ""), duration = c(10, 10, 5, 5, 6, 24, 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, 105, 15, 5, 60, 40, NA)), .Names = c("Akce", "Typ", "person", "time", "duration"), class = "data.frame", row.names = c(NA, -59L))>Best regards Petr ________________________________ Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho syst?mu. Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i zpo?d?n?m p?enosu e-mailu. V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce s dodatkem ?i odchylkou. - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.
Hi Petr, I'm not exactly sure this is what you are looking for, but try: start_indices<-which(!is.na(temp$duration)) pp_gantt_info<-list( labels=paste(as.character(temp$person[start_indices]), temp$Akce,temp$Typ,sep="-"), starts=temp$time[start_indices], ends=temp$time[start_indices+1], require(plotrix) vgridpos<-as.POSIXct(strptime( paste("2015-06-23 ",c(16,17,18,19,20,21,22,23),":00:00",sep=""), format="%Y-%m-%d %H:%M:%S")) vgridlab<-paste(c(16,17,18,19,20,21,22,23),":00",sep="") gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) Jim On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr <petr.pikal at precheza.cz> wrote:> Dear all > > Did anybody tried to do time management graphs in R? > > I could do some aggregation > > xtabs(duration~person+Typ, data=temp) > > but I would like to make also a graph to show which task (Typ) and when was done by which person. The closest I came till this evening is following graph, but it is not exactly what I want. > > library(ggplot2) > p<-ggplot(temp, aes(x=time, y=Typ, colour=person)) > p+geom_line() > > If anybody can focus me to proper functions or packages I would be greatful. > > Here are the data. > > temp <- structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, > 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, > 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, > 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, > 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c("a", > "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", > "o", "p", "q", "r", "s", "t", "u", "v", "w", "x"), class = "factor"), > Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, > 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, > 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, > 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, > 6L, 7L, 4L, 4L), .Label = c("A", "B", "C", "D", "E", "F", > "G", "H"), class = "factor"), person = structure(c(1L, 1L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("One", > "Two"), class = "factor"), time = structure(c(1435038600, > 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, > 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, > 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, > 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, > 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, > 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, > 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, > 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, > 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, > 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, > 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, > 1435062000, 1435065600, 1435068000), class = c("POSIXct", > "POSIXt"), tzone = ""), duration = c(10, 10, 5, 5, 6, 24, > 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, > 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, > 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, > 105, 15, 5, 60, 40, NA)), .Names = c("Akce", "Typ", "person", > "time", "duration"), class = "data.frame", row.names = c(NA, > -59L)) >> > > Best regards > Petr > > > ________________________________ > Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. > Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho syst?mu. > Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. > Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i zpo?d?n?m p?enosu e-mailu. > > V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: > - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. > - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce s dodatkem ?i odchylkou. > - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. > - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. > > This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. > If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. > If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. > The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. > > In case that this e-mail forms part of business dealings: > - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. > - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. > - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. > - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Another option would be to use segments instead of lines. library(lubridate) temp$end <- temp$time + minutes(temp$duration) library(ggplot2) ggplot(temp, aes(x=time, xend = end, y=Typ, yend = Typ, colour=person)) + geom_segment() ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-06-24 12:50 GMT+02:00 Jim Lemon <drjimlemon at gmail.com>:> Hi Petr, > I'm not exactly sure this is what you are looking for, but try: > > start_indices<-which(!is.na(temp$duration)) > pp_gantt_info<-list( > labels=paste(as.character(temp$person[start_indices]), > temp$Akce,temp$Typ,sep="-"), > starts=temp$time[start_indices], > ends=temp$time[start_indices+1], > require(plotrix) > vgridpos<-as.POSIXct(strptime( > paste("2015-06-23 ",c(16,17,18,19,20,21,22,23),":00:00",sep=""), > format="%Y-%m-%d %H:%M:%S")) > vgridlab<-paste(c(16,17,18,19,20,21,22,23),":00",sep="") > gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) > > Jim > > > On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr <petr.pikal at precheza.cz> > wrote: > > Dear all > > > > Did anybody tried to do time management graphs in R? > > > > I could do some aggregation > > > > xtabs(duration~person+Typ, data=temp) > > > > but I would like to make also a graph to show which task (Typ) and when > was done by which person. The closest I came till this evening is following > graph, but it is not exactly what I want. > > > > library(ggplot2) > > p<-ggplot(temp, aes(x=time, y=Typ, colour=person)) > > p+geom_line() > > > > If anybody can focus me to proper functions or packages I would be > greatful. > > > > Here are the data. > > > > temp <- structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, 15L, > > 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, > > 1L, 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, > > 13L, 14L, 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, > > 11L, 15L, 5L, 24L, 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c("a", > > "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", > > "o", "p", "q", "r", "s", "t", "u", "v", "w", "x"), class = "factor"), > > Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, > > 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, > > 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, > > 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, > > 6L, 7L, 4L, 4L), .Label = c("A", "B", "C", "D", "E", "F", > > "G", "H"), class = "factor"), person = structure(c(1L, 1L, > > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, > > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, > > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("One", > > "Two"), class = "factor"), time = structure(c(1435038600, > > 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, > > 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, > > 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, > > 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, > > 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, > > 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, > > 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, > > 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, > > 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, > > 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, > > 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, > > 1435062000, 1435065600, 1435068000), class = c("POSIXct", > > "POSIXt"), tzone = ""), duration = c(10, 10, 5, 5, 6, 24, > > 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, > > 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, > > 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, > > 105, 15, 5, 60, 40, NA)), .Names = c("Akce", "Typ", "person", > > "time", "duration"), class = "data.frame", row.names = c(NA, > > -59L)) > >> > > > > Best regards > > Petr > > > > > > ________________________________ > > Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou > ur?eny pouze jeho adres?t?m. > > Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? > neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie > vyma?te ze sv?ho syst?mu. > > Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento > email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. > > Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou > modifikacemi ?i zpo?d?n?m p?enosu e-mailu. > > > > V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: > > - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? > smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. > > - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? > p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze > strany p??jemce s dodatkem ?i odchylkou. > > - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve > v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. > > - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za > spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n > nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto > emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich > existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. > > > > This e-mail and any documents attached to it may be confidential and are > intended only for its intended recipients. > > If you received this e-mail by mistake, please immediately inform its > sender. Delete the contents of this e-mail with all attachments and its > copies from your system. > > If you are not the intended recipient of this e-mail, you are not > authorized to use, disseminate, copy or disclose this e-mail in any manner. > > The sender of this e-mail shall not be liable for any possible damage > caused by modifications of the e-mail or by delay with transfer of the > email. > > > > In case that this e-mail forms part of business dealings: > > - the sender reserves the right to end negotiations about entering into > a contract in any time, for any reason, and without stating any reasoning. > > - if the e-mail contains an offer, the recipient is entitled to > immediately accept such offer; The sender of this e-mail (offer) excludes > any acceptance of the offer on the part of the recipient containing any > amendment or variation. > > - the sender insists on that the respective contract is concluded only > upon an express mutual agreement on all its aspects. > > - the sender of this e-mail informs that he/she is not authorized to > enter into any contracts on behalf of the company except for cases in which > he/she is expressly authorized to do so in writing, and such authorization > or power of attorney is submitted to the recipient or the person > represented by the recipient, or the existence of such authorization is > known to the recipient of the person represented by the recipient. > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.[[alternative HTML version deleted]]
Hi Jim Thanks a lot. gantt.chart is worth trying, beside Thierry's segment solution. I need to think it over if it can be better for visualisation. Cheers Petr> -----Original Message----- > From: Jim Lemon [mailto:drjimlemon at gmail.com] > Sent: Wednesday, June 24, 2015 12:50 PM > To: PIKAL Petr > Cc: r-help at r-project.org > Subject: Re: [R] time management graph > > Hi Petr, > I'm not exactly sure this is what you are looking for, but try: > > start_indices<-which(!is.na(temp$duration)) > pp_gantt_info<-list( > labels=paste(as.character(temp$person[start_indices]), > temp$Akce,temp$Typ,sep="-"), > starts=temp$time[start_indices], > ends=temp$time[start_indices+1], > require(plotrix) > vgridpos<-as.POSIXct(strptime( > paste("2015-06-23 ",c(16,17,18,19,20,21,22,23),":00:00",sep=""), > format="%Y-%m-%d %H:%M:%S")) > vgridlab<-paste(c(16,17,18,19,20,21,22,23),":00",sep="") > gantt.chart(pp_gantt_info,vgridpos=vgridpos,vgridlab=vgridlab) > > Jim > > > On Wed, Jun 24, 2015 at 2:05 AM, PIKAL Petr <petr.pikal at precheza.cz> > wrote: > > Dear all > > > > Did anybody tried to do time management graphs in R? > > > > I could do some aggregation > > > > xtabs(duration~person+Typ, data=temp) > > > > but I would like to make also a graph to show which task (Typ) and > when was done by which person. The closest I came till this evening is > following graph, but it is not exactly what I want. > > > > library(ggplot2) > > p<-ggplot(temp, aes(x=time, y=Typ, colour=person)) > > p+geom_line() > > > > If anybody can focus me to proper functions or packages I would be > greatful. > > > > Here are the data. > > > > temp <- structure(list(Akce = structure(c(16L, 18L, 20L, 13L, 1L, > 15L, > > 4L, 12L, 8L, 22L, 16L, 15L, 5L, 24L, 13L, 16L, 6L, 1L, 15L, 11L, 1L, > > 5L, 24L, 7L, 1L, 10L, 21L, 23L, 3L, 2L, 9L, 14L, 17L, 20L, 13L, 14L, > > 19L, 14L, 4L, 1L, 15L, 5L, 24L, 13L, 15L, 1L, 14L, 11L, 15L, 5L, 24L, > > 7L, 1L, 10L, 14L, 23L, 3L, 2L, 9L), .Label = c("a", "b", "c", "d", > > "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", > > "s", "t", "u", "v", "w", "x"), class = "factor"), > > Typ = structure(c(4L, 6L, 6L, 6L, 2L, 6L, 6L, 1L, 1L, 8L, > > 4L, 6L, 6L, 6L, 6L, 4L, 1L, 2L, 6L, 5L, 2L, 6L, 6L, 6L, 2L, > > 3L, 4L, 6L, 7L, 4L, 4L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 6L, 2L, > > 6L, 6L, 6L, 6L, 6L, 2L, 7L, 5L, 6L, 6L, 6L, 6L, 2L, 3L, 7L, > > 6L, 7L, 4L, 4L), .Label = c("A", "B", "C", "D", "E", "F", > > "G", "H"), class = "factor"), person = structure(c(1L, 1L, > > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, > > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, > > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label > c("One", > > "Two"), class = "factor"), time = structure(c(1435038600, > > 1435039200, 1435039800, 1435040100, 1435040400, 1435040760, > > 1435042200, 1435042680, 1435043220, 1435043400, 1435043700, > > 1435044300, 1435044600, 1435045200, 1435046400, 1435046700, > > 1435047000, 1435047300, 1435047600, 1435048800, 1435050600, > > 1435051200, 1435051800, 1435053300, 1435053900, 1435054500, > > 1435060800, 1435061700, 1435062000, 1435064400, 1435068000, > > 1435038600, 1435039200, 1435039800, 1435040100, 1435040280, > > 1435041060, 1435041600, 1435042200, 1435042800, 1435043400, > > 1435044600, 1435045200, 1435046400, 1435047000, 1435047300, > > 1435047600, 1435048800, 1435050600, 1435051200, 1435051800, > > 1435053300, 1435053900, 1435054500, 1435060800, 1435061700, > > 1435062000, 1435065600, 1435068000), class = c("POSIXct", > > "POSIXt"), tzone = ""), duration = c(10, 10, 5, 5, 6, 24, > > 8, 9, 3, 5, 10, 5, 10, 20, 5, 5, 5, 5, 20, 30, 10, 10, 25, > > 10, 10, 105, 15, 5, 40, 60, NA, 10, 10, 5, 3, 13, 9, 10, > > 10, 10, 20, 10, 20, 10, 5, 5, 20, 30, 10, 10, 25, 10, 10, > > 105, 15, 5, 60, 40, NA)), .Names = c("Akce", "Typ", "person", > > "time", "duration"), class = "data.frame", row.names = c(NA, > > -59L)) > >> > > > > Best regards > > Petr________________________________ Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho syst?mu. Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i zpo?d?n?m p?enosu e-mailu. V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce s dodatkem ?i odchylkou. - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.