(PR#1608) merge.data.frame can coerce character vectors to factor in some circumstances (PR#1608)

David Kane <David Kane a296180@agate.fmr.com
Wed, 29 May 2002 08:48:03 -0400


Prof Brian D Ripley writes:
 > I have already patiently explained it to you.  It is a side issue of
 > subscripting of data frames converting character columns to factor.
 > I have also given you a workaround.

Yes, and many thanks for the patient explanations! Indeed, thanks to you and
the rest of R core for a simply amazing piece of software. Even though our
budget would allow us to use most any statistics package around, we use R
because it seems to us to be the best.

My only comment on the workaround (using I() to create vectors of class AsIs)
is that it is largely undocumented. I was concerned that, in this case,
undocumented meant "discouraged from use and possibly not present in future
versions." In any event, we will now do as you suggested.

 > As I said before, this is a consequence of the general rules.  Data frames
 > are not designed to have character columns, and those who insist on using
 > them must make themselves aware of the consequences.

Ahh! It had never been clear to me that data frames are not "designed to have
character columns." Of course, now that I carefully (re)read the documentation,
I see that this is the case. My comment here is that R certainly provides
enough rope (colClasses as "character" in read.table, for example) for
unsuspecting users like me to hang themselves on this point. Indeed, I would
wager that the vast majority of users (even some members of R core?) have
dataframes with character variables in them. My question is: Why aren't
dataframes "designed" to have character columns? This would seem to be a
desirable feature . . . but perhaps I am misunderstanding what a dataframe
really "is". Or, perhaps the answer is: "Patches are accepted." ;-)

Thanks again,

Dave Kane
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._