[R] Gantt Chart Using Plotrix
Sarah Goslee
@@r@h@go@|ee @end|ng |rom gm@||@com
Mon Apr 23 00:30:45 CEST 2018
Hi,
The help file for gantt.chart states that dates must be in POSIXct
format, and the example shows how to do that. There's no reason that I
can see that you can't use a data frame as input to gantt.chart, but
you need to be very careful that your data frame matches the correct
format. I bet also that your character fields were imported as
factors, because you didn't specify not to.
Try running the first couple lines of the example code, then compare
str(abc)
with
str(gantt.info)
and adjust the format of your dataset as necessary.
If you still can't figure it out, then use dput(abc) to provide a
reproducible example, and submit that to the list. We can't tell the
format of the various columns from a copy and paste.
Sarah
On Sun, Apr 22, 2018 at 6:10 PM, <bbb_aaa using verizon.net> wrote:
> From the help file for plotrix:
> " ... x - a list of task labels, start/end times and task priorities as returned by get.gantt.info ..."
>
> So I try to create an object that will contain this information.
>
> abc <- read.csv("gntr1a.csv")
>
> # The above csv file was generated from MS .xlsx file containing the tasks and corresponding dates
>
>> abc
> code tasks.labels start end depends done
> 1 101 task 1 2018/04/01 2018/04/15 NA 100
> 2 102 task2 2018/04/15 2018/05/31 101 50
> 3 103 task 3 2018/06/01 2018/06/30 102 0
>> gantt.chart(abc)
> Error in `$<-.data.frame`(`*tmp*`, priorities, value = numeric(0)) :
> replacement has 0 rows, data has 3
>>
>
> Manually adding the required tasks and dates (as given in the help file example) is not practical for my situation ....
>
>
>
>
>
> -----Original Message-----
> From: David Winsemius <dwinsemius using comcast.net>
> To: bbb_aaa <bbb_aaa using verizon.net>
> Cc: r-help <r-help using r-project.org>
> Sent: Sun, Apr 22, 2018 4:31 pm
> Subject: Re: [R] Gantt Chart Using Plotrix
>
>
>> On Apr 22, 2018, at 11:50 AM, bbb_aaa using verizon.net wrote:
>>
>> Hi
>>
>> I am trying to generate a complex Gantt chart using the gantt.chart function in the plotrix package.
>>
>> Ideally I would like to use a spreadsheet to populate the activities (tasks) and start and end dates that this function expects and then export the spreadsheet file as a .CSV text file so I can read in this file to generate the gantt chart. Reading through the help file I have not been able to see what exactly this spreadsheet should like. The example provided with the "gantt.chart" function seems to indicate all the information needs to be hand coded. Because of the complexity of my chart this is not only very error prone but also is impractical.
>>
>> Can anyone help me with this? There is also a "get.gantt.info" function for creating a gantt object but the help on this is almost next to nothing !
>>
>> Any help you can provide on this would be great.
>>
>> There is another R package called "plan" which is very user friendly but for my purpose this doesn't have all the functionality I am looking for.
>
> The method to generate the most interest and attention to a question is to post a reproducible example with a clear description of the desired "functionality".
>
>>
>> Thanks
>> indr
>>
>> ______________________________________________
>> R-help using 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.
>
> David Winsemius
> Alameda, CA, USA
>
> 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
>
--
Sarah Goslee
http://www.functionaldiversity.org
More information about the R-help
mailing list