Re: [Rd] c.factor

2006-11-22 Thread Matthew Dowle
I just noticed that a new feature in R 2.4 is that unlist of a list of factors already does the operation that I proposed : > x = factor(letters[1:5]) > y = factor(letters[4:8]) > unlist(list(x,y)) [1] a b c d e d e f g h Levels: a b c d e f g h > Therefore, does it not make sense that c(x,y) s

Re: [Rd] c.factor

2006-11-22 Thread Matthew Dowle
I noticed that a new feature in R 2.4 is that unlist of a list of factors already does the operation that I proposed : > x = factor(letters[1:5]) > y = factor(letters[4:8]) > unlist(list(x,y)) [1] a b c d e d e f g h Levels: a b c d e f g h > Therefore, does it not make sense that c(x,y) shoul

Re: [Rd] c.factor

2006-11-15 Thread Roger Bivand
On Wed, 15 Nov 2006, Barry Rowlingson wrote: > > > > > It does not remove names in Splus either, just all > > other attributes. I see c() used in several Splus > > functions as a way to convert a matrix into a vector > > (by removing the .Dims and .Dimnames attributes). > > > > I dont see t

Re: [Rd] c.factor

2006-11-15 Thread Barry Rowlingson
> > It does not remove names in Splus either, just all > other attributes. I see c() used in several Splus > functions as a way to convert a matrix into a vector > (by removing the .Dims and .Dimnames attributes). > I dont see the logic in certain attribute names (?attr lists 'class', 'comm

Re: [Rd] c.factor

2006-11-15 Thread Bill Dunlap
> > In addition, c() has always had a double meaning of > > (a) turning an object into a simple "vector" (an object > > without "attributes"), as in > > > c(factor(c("Cat","Dog","Cat"))) > > [1] 1 2 1 > > > c(data.frame(x=1:2,y=c("Dog","Cat"))) > > $x > > [1] 1 2 > >

Re: [Rd] c.factor

2006-11-15 Thread Matthew Dowle
> Just for clarification, my interest was only to provide an > alternative that provided for a more generic approach, at > least in a narrow application, not that I was advocating it's > need. Understood, apologies for falsely implying your advocation. > I would agree with Prof. Ripley's comm

Re: [Rd] c.factor

2006-11-15 Thread Marc Schwartz
On Wed, 2006-11-15 at 12:51 +, Matthew Dowle wrote: > I have a solution which works for me, and I have contributed it. One > other person has shown some interest, and taken it further to work with > multiple arguments which looks like a nice improvement. Just for clarification, my interest

Re: [Rd] c.factor

2006-11-15 Thread Matthew Dowle
s case, which is why I avoided it in the solution I posted. Regards, Matthew > -Original Message- > From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] > Sent: 14 November 2006 18:23 > To: Marc Schwartz > Cc: Matthew Dowle; r-devel@r-project.org > Subject: Re: [Rd] c.fa

Re: [Rd] c.factor

2006-11-15 Thread Brian Ripley
On Tue, 14 Nov 2006, Bill Dunlap wrote: > On Tue, 14 Nov 2006, Prof Brian Ripley wrote: > >> Well, R has managed without a factor method for c() for most of its decade >> of existence (not that it originally had factors as we know them). >> >> I would argue that factors are best viewed as an enume

Re: [Rd] c.factor

2006-11-14 Thread Bill Dunlap
On Tue, 14 Nov 2006, Prof Brian Ripley wrote: > Well, R has managed without a factor method for c() for most of its decade > of existence (not that it originally had factors as we know them). > > I would argue that factors are best viewed as an enumeration type, and > anything which silently chang

Re: [Rd] c.factor

2006-11-14 Thread Marc Schwartz
On Tue, 2006-11-14 at 16:36 +, Matthew Dowle wrote: > Hi, > > Given factors x and y, c(x,y) does not seem to return a useful result : > > x > [1] a b c d e > Levels: a b c d e > > y > [1] d e f g h > Levels: d e f g h > > c(x,y) > [1] 1 2 3 4 5 1 2 3 4 5 > > > > Is there a case for a new m

Re: [Rd] c.factor

2006-11-14 Thread Prof Brian Ripley
Well, R has managed without a factor method for c() for most of its decade of existence (not that it originally had factors as we know them). I would argue that factors are best viewed as an enumeration type, and anything which silently changes their level set is a bad idea. I can see a case f

Re: [Rd] c.factor

2006-11-14 Thread Marc Schwartz
On Tue, 2006-11-14 at 11:51 -0600, Marc Schwartz wrote: > On Tue, 2006-11-14 at 16:36 +, Matthew Dowle wrote: > > Hi, > > > > Given factors x and y, c(x,y) does not seem to return a useful result : > > > x > > [1] a b c d e > > Levels: a b c d e > > > y > > [1] d e f g h > > Levels: d e f g h