[R] why is this a factor?

Rolf Turner rolf.turner at xtra.co.nz
Fri Aug 30 00:03:35 CEST 2013


On 29/08/13 12:10, Ista Zahn wrote:
> On Wed, Aug 28, 2013 at 7:44 PM, Steve Lianoglou
> <lianoglou.steve at gene.com> wrote:
>> Hi,
>>
>> On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn <istazahn at gmail.com> wrote:
>>> Or go all the way and put
>>>
>>> options(stringsAsFactors = FALSE)
>>>
>>> at the top your script or in your .Rprofile. This will prevent this
>>> kind of annoyance in the future without having to say stringsAsFactors
>>> = FALSE all the time.
>> I go back and forth about doing this too (setting a global hammer to
>> stringsAsFactors), but then other things might mess up -- imagine a
>> scenario where a package is written with the assumption that the
>> default `stringsAsFactors=TRUE` setting hasn't been changed, which
>> could then break when you go the nuclear-global-override route.
> Yes, possibly, but I've yet to have that problem, whereas before I
> started changing it globally things used to break fairly regularly.

Like Ista I have never had a problem arising from a package's assuming that
`stringsAsFactors=TRUE` --- and I would opine that any package making such
an assumption is badly written.  (Of course there is a lot of bad code 
out there ....)

I have once or twice stumbled over a conundrum in respect of questions 
posed on
r-help where the poster assumed `stringsAsFactors=TRUE`.  But I 
eventually figured
out what was going on.  (And anyway that's the poster's problem, as far 
as I'm
concerned.)

     cheers,

     Rolf



More information about the R-help mailing list