On Aug 24, 2009, at 8:22 AM, 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").

> my.gantt.info<-read.csv(textConnection(" 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"))
> my.gantt.info
         labels...starts.....ends
1 1  first task 1-Jan-04 3-Mar-04
2 2 second task 2-Feb-04 5-May-04
3 3  third task 3-Mar-04 6-Jun-04
4 4 fourth task 4-Apr-04 8-Aug-04
5 5  fifth task 5-May-04 9-Sep-04

So that may look successful to you but that data.frame contains all of that data in a single (character) column. Why? Because a function was expecting commas on a file that did not have any. You will probably get further along if you use read.table with header=TRUE. Maybe you did something different or the file did have commas. With such a small file, you really should present the results of

dput(my.gantt.info)

That will contain all the values and attributes of the R object ... no more guessing, which is what we are doing now.

and for create gantt chart i used below code.

gantt.chart("my.gantt.info").

That looks wrong. my.gantt.info is an R object. Is gantt.chart (from whatever unspecified package) really expecting to have its arguments quoted? I would bet against that possibility.

I would also guess that, even if the data input issues are not a problem and the quotes are removed, you still have not converted those character values that you think look like dates into objects that R will interpret as dates.

?as.Date


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.
Thanks in Advance.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
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