[R] Hmisc describe error

David Winsemius dwinsemius at comcast.net
Mon Oct 1 19:42:21 CEST 2012


On Oct 1, 2012, at 10:27 AM, David Winsemius wrote:

> 
> On Oct 1, 2012, at 9:48 AM, stephenb wrote:
> 
>> The error is just a misleading error message. loading the data produced
>> column sdate as 
>>> str(prostate)
>> $ sdate :Classes 'labelled', 'dates'  atomic [1:502] 2778 2820 2933 2999
>> 3002 ...
>> .. ..- attr(*, "format")= symbol ddmmmyy
>> .. ..- attr(*, "label")= chr "Date on study"
>> 
>> prostate$sdate <- as.Date(prostate$sdate,origin="1970-01-01")  # fixes the
>> problem and 'describe' runs
>> 
>> just as a comment: maybe the R dataset should have sdate as a Date class.
>> 
> 
> What "R dataset"? From what package?
> 
> And it's already a "dates"-classed variable. 

Not only that, but there is a message at the top of Harrell's Datasets page that says:

"For R users of the prostate dataset, put library(chron) into effect to handle date variables. A simpler approach is to just convert the one date variable to the built-in R format by running the command prostate$sdate <- as.Date(prostate$sdate)."

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list