[R] Large matrix into a vector

Marc Schwartz marc_schwartz at comcast.net
Thu Mar 29 00:11:14 CEST 2007


On Wed, 2007-03-28 at 19:55 -0200, Alberto Monteiro wrote:
> Prof Brian Ripley wrote:
> >
> > We have already seen three solutions.
> > 
> > I don't like to see the use of c() for its side effects.  In this 
> > case Marc's as.vector seems to me to be self-explanatory, and that 
> > is a virtue in programming that is too often undervalued.
> > 
> I agree; but for our enlightnment, what are the side effects of
> c()?
> 
> Alberto Monteiro

I believe that Prof. Ripley is referring to the following, from the
Details section in ?c:


"c is sometimes used for its side effect of removing attributes except
names, for example to turn an array into a vector. as.vector is a more
intuitive way to do this, but also drops names."


There are also examples in ?c of this behavior.

HTH,

Marc



More information about the R-help mailing list