[R] HMisc describe -- error with dates

Gabor Grothendieck
Wed, 12 Nov 2003 01:40:50 -0000

dates is part of chron.  There may be something wrong in
Hmisc's detection of chron objects.

> chron(1)
[1] 01/02/70

> isChron(chron(1))
FALSE

---

Date: Tue, 11 Nov 2003 20:06:38 -0500
From: <tmurph6 at po-box.mcgill.ca>
To: Frank E Harrell Jr <feh3k at spamcop.net>
Cc: <r-help at stat.math.ethz.ch>
Subject: Re: [R] HMisc describe -- error with dates



I am using the chron package. I have no preference for which function I use. I
just want the most reliable format for HMisc functions and general plotting. I
like the ddmonyyy formats (e.g. 11NOV2003). What would you recommend?

Thank you!

Quoting Frank E Harrell Jr <feh3k at spamcop.net>:

> On Tue, 11 Nov 2003 18:28:24 -0500
> tmurph6 at po-box.mcgill.ca wrote:
>
> > Hello,
> >
> > I am trying to use HMisc describe on a data frame. I have specified
> > certain variables as dates using, for example:
> >
> > df1$aidsdate <- dates(aidsdate,format="day.mon.year",
> > origin=c(month = 1, day = 1, year = 1960))
> >
> > When I use describe on the dataframe I get this error:
> >
> > Error in Ops.dates(weights, x) : * not defined for chron objects
> >
> > Has anyone had this problem? I had used the same method with an older
> > version of R and HMisc and it worked.
> >
> > Should be be formatting date variables differently?
> >
> > Thank you!
> >
> > Sincerely,
> > Tanya Murphy
> >
>
> In recent versions, describe for R recognizes date/times by one of the
> following classes: 'POSIXt','POSIXct','chron'. If
you really need to use
> another date format I could be talked into extending the code for that if
> you can remind me where dates( ) is found. -Frank
>
> ---
> Frank E Harrell Jr Professor and Chair School of Medicine
> Department of Biostatistics Vanderbilt University
>