Hi Everyone, i have a data frame like this labels starts ends priorities 1 firsttask 37987 38049 1 2 secondtask 38019 38112 2 3 thirdtask 38049 38144 3 4 fourthtask 38081 38207 4 5 fifthtask 38112 38239 5 now i want to apply a date format for the two variables they are "starts" and "ends". please help in this aspect it would be appreciable. Thanks in Advance. -- View this message in context: http://www.nabble.com/how-to-apply-a-date-format-for-data-frame-tp25129192p25129192.html Sent from the R help mailing list archive at Nabble.com.
rajclinasia wrote:> Hi Everyone, > > i have a data frame like this > > labels starts ends priorities > 1 firsttask 37987 38049 1 > 2 secondtask 38019 38112 2 > 3 thirdtask 38049 38144 3 > 4 fourthtask 38081 38207 4 > 5 fifthtask 38112 38239 5 > > now i want to apply a date format for the two variables they are "starts" > and "ends".Would be helpful to know which date format and what the coding means. Uwe Ligges> please help in this aspect it would be appreciable. > Thanks in Advance.
On Mon, 24 Aug 2009 23:42:11 -0700 (PDT) rajclinasia <raj at clinasia.com> wrote: R> labels starts ends priorities R> 1 firsttask 37987 38049 1 It is easier with the other data.frame you had with: labels starts ends 1 first task 1-Jan-04 3-Mar-04 and as.Date see ?as.Date e.g. as.Date("1-Jan-04","%d-%b-%y") or for the whole column: myframe$starts<-as.Date(myframe$starts,"%d-%b-%y") now I hope you have learnt how to get the data into a list for the gantt.chart... hth Stefan
Assuming your starts and ends are the number of days since some starting point (day 0), then following this example might do what you want:> x <- 45678 > class(x) <- 'Date' > x[1] "2095-01-23" You will have to study the documentation to find out if your starting point is the same as R's, and if not, how to adjust. -Don At 11:42 PM -0700 8/24/09, rajclinasia wrote:>Hi Everyone, > >i have a data frame like this > > labels starts ends priorities >1 firsttask 37987 38049 1 >2 secondtask 38019 38112 2 >3 thirdtask 38049 38144 3 >4 fourthtask 38081 38207 4 >5 fifthtask 38112 38239 5 > >now i want to apply a date format for the two variables they are "starts" >and "ends". >please help in this aspect it would be appreciable. >Thanks in Advance. >-- >View this message in context: >http://*www.*nabble.com/how-to-apply-a-date-format-for-data-frame-tp25129192p25129192.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >R-help at 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.-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062