I think the better way to deal with this problem is a global fix:
options(stringsAsFactors=F)
Set this as your permanent global default, and life with Splus or R will
be much better. Turning strings into factors presumes a particular
viewpoint about what your analysis of them is going-to-be, and in my
experience the assumption is almost always wrong.
The default in S, like many defaults, corresponds to the analysis that
was being done at the time, by the package author, when the default was chosen.
(I'm not throwing rocks here: the survival package, which I wrote, has many
defaults with exactly the same justification). My gripe is that S/R turn
strings into factors, without warning, far too often. Thankfully the global
option fixes this.
For the Mayo installation (approx 150 users), both na.action=na.omit and
stringsAsFactors=F are the global default for all users. Doing so has made
life considerably simpler for those of us who support them.
Terry Therneau
|