From bill at insightful.com  Wed Nov 15 18:24:48 2006
From: bill at insightful.com (Bill Dunlap)
Date: Wed, 15 Nov 2006 09:24:48 -0800 (PST)
Subject: [Rd] c.factor
In-Reply-To: <Pine.LNX.4.64.0611150926070.19618@auk.stats>
References: <946928E281E8FD4B91D5B2CC3C91967D6AA9A0@lnex01.CONCORDIAFUNDS.COM>
	<1163526685.4492.20.camel@localhost.localdomain>
	<1163527030.4492.23.camel@localhost.localdomain>
	<Pine.LNX.4.64.0611141809050.25751@gannet.stats.ox.ac.uk>
	<Pine.GSO.4.56.0611141218410.17778@durian.statsci.com>
	<Pine.LNX.4.64.0611150926070.19618@auk.stats>
Message-ID: <Pine.GSO.4.56.0611150918020.12673@durian.statsci.com>

> > 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
> >
> >      $y
> >      [1] Dog Cat
> >      Levels: Cat Dog
>
> To my surprise that was not documented at all on the R help page, and I've
> clarified it.  (BTW, at least in R it does not remove names, just all
> other attributes.)

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 think working on a concat() for R would be helpful.  I vaguely recalled
> something like it in the Green Book, but the index does not help (but then
> it is not very complete).

Splus does have a concat().  I believe it is modelled
after the Green Book example.  It uses a helper function
called concat.two(x,y) with is generic and has 2 arguments
to make it easer to write methods for.  concat(x,y,z)
calls concat.two(concat.two(x,y),z).  concat() is not used much,
but it is the Summary group functions: min, max, sum, etc.

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."



[Rd] c.factor
Bill Dunlap