From maechler at stat.math.ethz.ch  Fri Jan 22 09:17:46 2010
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 22 Jan 2010 09:17:46 +0100
Subject: [Rd] Inconsistency in as.data.frame.table for stringsAsFactors
In-Reply-To: <8b356f881001211719o20f814a2w488aec8d648fc5f5@mail.gmail.com>
References: <8b356f881001211719o20f814a2w488aec8d648fc5f5@mail.gmail.com>
Message-ID: <19289.24362.734838.778263@lynne.math.ethz.ch>

>>>>> "SM" == Stavros Macrakis <macrakis at alum.mit.edu>
>>>>>     on Thu, 21 Jan 2010 20:19:28 -0500 writes:

    SM> I noticed that in as.data.frame.table, the stringsAsFactors argument
    SM> defaults to TRUE, whereas in the other as.data.frame methods, it defaults to
    SM> default.stringsAsFactors().

    SM> The documentation and implementation agree on this, so this is not a bug.

    SM> However, I was wondering if this disparity was intended or if it might be
    SM> some sort of unintentional oversight.  If it is intentional, I wonder what
    SM> the rationale is.

Some of us (including me) have strongly argued on several
occasions that  global options() settings should *not* have an effect
on anything "computing" but just on "output"
i.e. printing/graphing of R results.
As it is currently, potentially R scripts and R functions may
only work correctly for one setting of  
     options( stringsAsFactors = * )
which is against all principles of functional programming.

>From this (my) point of view, we should strive to eventually deprecate
default.stringsAsFactors() which basically returns getOption("stringsAsFactors"),
or as first/2nd step redefine it as

 default.stringsAsFactors <- function() TRUE

Martin M?chler.

    SM> Thanks,
    SM> -s



[Rd] Inconsistency in as.data.frame.table for stringsAsFactors
Martin Maechler