Skip to content
Prev 4803 / 398506 Next

Coercing character to factor

On Wed, 8 Mar 2000, Marc Feldesman wrote:

            
Yes. stataread reads Stata string variables as character.  I think this is
the right thing to do, since Stata recommends that you use numeric
variables with labels if you really just have factors and generally
doesn't encourage the use of strings.

model.frame doesn't allow character variables.  It would be possible for
model.frame to coerce characters to factors, but it currently doesn't. We
would certainly recommend that you explicitly coerce strings to factors
rather than having it happen automatically, but it may be that model.frame
should handle strings as a fallback position (perhaps with a warning).

rpart is completely blameless :)


	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._