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

Bert Gunter gunter.berton at gene.com
Fri Aug 17 20:19:56 CEST 2012


Steve, et. al:

Yes, if object.size() is to be believed, you're right:

> x <-sample(c("small","medium","large"),1e4,rep=TRUE)
> y <- factor(x)
> object.size(x)
40120 bytes
> object.size(y)
40336 bytes

I stand (happily) corrected.

-- Bert

On Fri, Aug 17, 2012 at 11:09 AM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> Hi,
>
> On Fri, Aug 17, 2012 at 1:58 PM, Jeff Newmiller
> <jdnewmil at dcn.davis.ca.us> wrote:
>> I don't know if my recent post on this prompted your post, but I don't see much to argue with in your discussion. I find factors to be useful for managing display and some kinds of analysis.
>>
>> However, I find them mostly a handicap when importing, merging, and handling data QC. Therefore I delay conversion until late in the game... but usually I do eventually convert in most cases.
>
> Agreed here -- I actually haven't been tuned into any such recent
> conversation (if there was one), but if I were a gambling man, I'd bet
> that the majority of the problems people have with factors can
> probably be boiled down to the fact that the default value for
> stringsAsFactors is TRUE.
>
> I like factors -- that said, I am annoyed by them at times, but I
> still like them.
>
> Also, Bert mentioned that he thinks they save space over characters --
> I believe that this is no longer true, but I'm not certain.
>
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list