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

2012-08-20 Thread S Ellison
>> on the whole, it seems to me that character >> input gets used as factor data so much of the time when it is >> used at all that the default stringsAsFactors=TRUE setting >> seems the more sensible default. > > I disagree with this last point. Just think of the number of > questions to this

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

2012-08-20 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rui Barradas > Sent: Monday, August 20, 2012 2:03 PM > To: S Ellison > Cc: r-help > Subject: Re: [R] Opinion: Why I find factors convenient to use >

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

2012-08-20 Thread Nutter, Benjamin
radas Sent: Monday, August 20, 2012 8:03 AM To: S Ellison Cc: r-help Subject: Re: [R] Opinion: Why I find factors convenient to use Hello, Em 20-08-2012 12:30, S Ellison escreveu: > > >> -Original Message- >> Over the years, many people -- including some who I wou

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

2012-08-20 Thread Rui Barradas
Hello, Em 20-08-2012 12:30, S Ellison escreveu: -Original Message- Over the years, many people -- including some who I would consider real expeRts -- have criticized factors and advocated the use (sometimes exclusively) of character vectors instead. Exclusive use of character vector

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

2012-08-20 Thread S Ellison
> -Original Message- > Over the years, many people -- including some who I would > consider real expeRts -- have criticized factors and > advocated the use (sometimes exclusively) of character > vectors instead. Exclusive use of character vectors is not going to do the job. The con

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

2012-08-18 Thread Jim Lemon
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 manipul

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

2012-08-18 Thread Petr Savicky
On Fri, Aug 17, 2012 at 07:34:35PM +0100, Rui Barradas wrote: > Hello, > > No, factors may use less memory. System dependent? > > > x <-sample(c("small","medium","large"),1e4,rep=TRUE) > > y <- factor(x) > > object.size(x) > 80184 bytes > > object.size(y) > 40576 bytes > > > > sessionInfo() > R v

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

2012-08-17 Thread Rui Barradas
Hello, Em 17-08-2012 20:27, Bert Gunter escreveu: ... so it may be just the way object.size() counts in the two cases, right? Or maybe the way character vectors and factors are coded. (64 bit Windows 7 or ubuntu 12.04) 80k for the character vector seems to be 8 * 1e4 for pointers plus room fo

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

2012-08-17 Thread Peter Langfelder
On Fri, Aug 17, 2012 at 11:34 AM, Rui Barradas wrote: > Hello, > > No, factors may use less memory. System dependent? I think it's a 32-bit vs. 64-bit distinction - I get Rui's results on 64-bit Windows and Linux installation, but Bert's result on a 32-bit Linux machine. Peter > >> x <-sample(c

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

2012-08-17 Thread Rui Barradas
Hello, No, factors may use less memory. System dependent? > x <-sample(c("small","medium","large"),1e4,rep=TRUE) > y <- factor(x) > object.size(x) 80184 bytes > object.size(y) 40576 bytes > > sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COL

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

2012-08-17 Thread Bert Gunter
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 wrote:

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

2012-08-17 Thread Steve Lianoglou
Hi, On Fri, Aug 17, 2012 at 1:58 PM, Jeff Newmiller 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 handi

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

2012-08-17 Thread Jeff Newmiller
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 dela

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

2012-08-17 Thread PIKAL Petr
I second to Bert's opinion, factors can be confusing, but they have quite nice features which can not be easily mimicked by plain character vectors. I find extremelly usefull possibility of manipulating its levels. > fac<-factor(sample(letters[1:5], 20, replace=TRUE)) > fac [1] e e d d e e c e