[R] error in creating gantt chart.

Jim Lemon jim at bitwrit.com.au
Tue Aug 25 12:35:06 CEST 2009


rajclinasia wrote:
> hi every one,
> i have a excel sheet like this
>
>        labels   starts     ends
> 1  first task 1-Jan-04 3-Mar-04
> 2 second task 2-Feb-04 5-May-04
> 3  third task 3-Mar-04 6-Jun-04
> 4 fourth task 4-Apr-04 8-Aug-04
> 5  fifth task 5-May-04 9-Sep-04
>
> now i converted this excel sheet into csv file and i read the csv file into
> R with the below code.
>
> my.gantt.info<-read.csv("C:/Documents and
> Settings/balakrishna/Desktop/one.csv").
>
> and for create gantt chart i used below code.
>
>  gantt.chart("my.gantt.info").
>
> if i run this above code i am getting the error like this 
>
> Error in x$starts : $ operator is invalid for atomic vectors.
>
>  can anybody help in this aspect it would be very appreciable.
>   
Hi Raj,
My apologies for not testing the solution I sent. The dates in the 
spreadsheet were converted to character strings, then factors in the 
input stage. If you reconvert them as follows:

my.gantt.info$starts<-as.POSIXct(strptime(my.gantt.info$starts,"%d-%b-%y"))
my.gantt.info$ends<-as.POSIXct(strptime(my.gantt.info$ends,"%d-%b-%y"))

things should work properly.

Jim




More information about the R-help mailing list