Marc Schwartz <[EMAIL PROTECTED]> 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 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
