From f.harrell at vanderbilt.edu  Wed Apr 25 19:00:39 2007
From: f.harrell at vanderbilt.edu (Frank E Harrell Jr)
Date: Wed, 25 Apr 2007 12:00:39 -0500
Subject: [Rd] [R] Coercing data types for use in model.frame
In-Reply-To: <Pine.LNX.4.64.0704251014120.2746@gannet.stats.ox.ac.uk>
References: <462ECEFD.8010705@vanderbilt.edu>
	<Pine.LNX.4.64.0704251014120.2746@gannet.stats.ox.ac.uk>
Message-ID: <462F8937.7020408@vanderbilt.edu>

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



[Rd] [R] Coercing data types for use in model.frame
Frank E Harrell Jr