[R] creating gantt chart

Jim Lemon jim at bitwrit.com.au
Sat Aug 22 11:25:16 CEST 2009


rajclinasia wrote:
> Hi every one,
> I have a R dataset like this.
>
> labels	    starts	               ends
> first task	   2004-01-01	2004-03-03
> second task 2004-02-02	2004-05-05
> third task	    2004-03-03	2004-06-06
> fourth task  2004-04-04	2004-08-08
> fifth task	   2004-05-05	2004-09-09
>
> now i want to create gantt chart for this data. can any body help us in
> code, it will be very helpful for us.
>   
Hi raj,
 From your two messages I assume that you have an Excel spreadsheet that 
looks something like the above data, and you want to convert this into a 
list that will produce a Gantt chart using the gantt.chart function. 
First, your example has alerted me to the fact that if the incoming list 
is missing the "priorities" component, gantt.chart will lose its lunch, 
so I have fixed this little problem and future versions will not be so 
picky. First, add a column like this:

priorities
1
2
3
4
5

to the spreadsheet. Then, to generate a data frame (which is a sort of 
list) from an Excel file, export (Save As...) the spreadsheet as a CSV 
file with commas as delimiters. Then read that file into R and display:

my.gantt.info<-read.csv("my.gantt.csv")
gantt.chart(my.gantt.info)

Jim




More information about the R-help mailing list