[R] Large matrix into a vector
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Thu Mar 29 00:29:30 CEST 2007
Marc Schwartz <marc_schwartz at comcast.net> writes:
> 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.
The terminology is a bit unfortunate, though. "Side effect" usually
means an effect that is not reflected in the return value of a
function, like printing, plotting, or assignment.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list