Skip to content
Prev 19940 / 398500 Next

Using merge can convert character variables to factor

I am not sure if this is a bug or a feature, but I could not find it
documented. In certain circumstances, using merge can convert a character
variable to factor. Consider a simple example:
Row.names         a         b 
 "factor" "integer"  "factor" 

So far, so good. b should be a factor since it is a factor in y.
[1] TRUE

Changing b to be a charcter variable works as well.
Row.names           a           b 
   "factor"   "integer" "character" 

But when we change the merge to include all of the x rows in the resulting
dataframe, we get:
Row.names         a         b 
 "factor" "integer"  "factor"
I think that b should still be a character variable in this case.

If this is a bug, please let me know and I would be happy to submit it.
_                   
platform sparc-sun-solaris2.6
arch     sparc               
os       solaris2.6          
system   sparc, solaris2.6   
status                       
major    1                   
minor    5.0                 
year     2002                
month    04                  
day      29                  
language R                   

Thanks,

Dave Kane
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._