[Rd] [R] Coercing data types for use in model.frame

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Apr 25 19:00:39 CEST 2007


Prof Brian Ripley wrote:
> Moved to R-devel ....
> 
> What is the 'data class'?  In particular what is its underlying type? 
> And where in model.frame[.default] are you trying to use it (in the 
> formula, data, in ..., etc).
> 
> This is an example of where some reproducible code and the error 
> messages would be very helpful indeed.
> 
> Brian

Brian,

Sorry - this was one of those "too late in the day" errors.  The problem 
was in a function called just before model.frame.  model.frame seems to 
work fine with an object of class c('mChoice', 'labelled').  It keeps 
mChoice variables as mChoice.  After model.frame is finished I'll change 
such variables to factors or matrices.

Frank


> 
> On Tue, 24 Apr 2007, Frank E Harrell Jr wrote:
> 
>> In the Hmisc package there is a new data class 'mChoice' for multiple
>> choice variables.  There are format and as.numeric methods (the latter
>> creates a matrix of dummy variables).  mChoice variables are not allowed
>> by model.frame.  Is there a way to specify a conversion function that
>> model.frame will use automatically?  I would use as.factor here.
>> model.frame does not seem to use as.data.frame.foo for individual 
>> variables.
>>
>> Thanks
>> Frank
>>
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-devel mailing list