Hi Thierry

Thanks a lot. This is the option I found later.

Still not 100% satisfactory. Maybe somebody did similar task and will have 
different opinion how to visualise such data.

Jim’s gant diagrams are worth consideration so I will try to elaborate it 
further.

Cheers
Petr

From: Thierry Onkelinx [mailto:thierry.onkel...@inbo.be]
Sent: Wednesday, June 24, 2015 1:48 PM
To: PIKAL Petr
Cc: r-help@r-project.org
Subject: Re: [R] time management graph

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 
<drjimle...@gmail.com<mailto:drjimle...@gmail.com>>:
Hi Petr,
I'm not exactly sure this is what you are looking for, but try:

start_indices<-which(!is.na<http://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.pi...@precheza.cz<mailto:petr.pi...@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@r-project.org<mailto:R-help@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@r-project.org<mailto:R-help@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.


________________________________
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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to