Re: [R] Handling of factors

2009-01-21 Thread Peter Dalgaard
Thomas Lumley wrote: > On Tue, 20 Jan 2009, Stavros Macrakis wrote: > >> I'm rather confused by the semantics of factors. >> > >> >> It is all very confusing. Of course, most of this behavior is >> documented and is easily determined by experimentation, but it would >> be easier to learn and tea

Re: [R] Handling of factors

2009-01-21 Thread Thomas Lumley
As a follow-up, I don't see any reason why rle() shouldn't work on factors. There's no ambiguity about what the result should be, and the current implementation in rle() would work on factors if they could get past the pre-test. -thomas On Wed, 21 Jan 2009, Thomas Lumley wrote: On T

Re: [R] Handling of factors

2009-01-21 Thread Thomas Lumley
On Tue, 20 Jan 2009, Stavros Macrakis wrote: I'm rather confused by the semantics of factors. It is all very confusing. Of course, most of this behavior is documented and is easily determined by experimentation, but it would be easier to learn and teach the language if there were some clea

[R] Handling of factors

2009-01-20 Thread Stavros Macrakis
I'm rather confused by the semantics of factors. When applied to factors, some functions (whose results are elements of the original factor argument) return results of class factor, some return integer vectors, some return character vectors, some give errors. I understand some but not all of this