[R] Opinion: Why I find factors convenient to use

Jim Lemon jim at bitwrit.com.au
Sat Aug 18 10:27:12 CEST 2012


On 08/18/2012 03:32 AM, Bert Gunter wrote:
> Folks:
> ...
> So contrary opinions
> cheerily welcomed. But perhaps these comments might be helpful to
> those who have been "bitten" by factors or just wonder what all the
> fuss is about.
>
I tend to use stringsAsFactors=FALSE quite a bit, as I am often 
manipulating character strings, and that

Error in strsplit(bugga, "") : non-character argument

is so annoying. Almost as annoying as printing out a list of selected 
cases with some of the fields turning up as integers rather than the 
strings I expected. That said, I often convert the results to factors so 
that some other function will work properly. So I must express my 
gratitude for motivating me to add

options(stringsAsFactors=FALSE)

to that wonderful .First function that makes my life a little happier 
every day.

Jim




More information about the R-help mailing list