On 17 Nov 2003 at 15:08, Ted Harding wrote: > On 15-Nov-03 Ted Harding wrote: > And the following (in today's "?for" thread) is a perfect example of > what I mean: > =============================================================== > > From: Peter Dalgaard <[EMAIL PROTECTED]> > To: Angel > <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: Re: [R] > ?for > Date: 17 Nov 2003 11:49:37 +0100 > > Further hint: ? is an > operator, syntactically similar to + and -. > You can apply operators > to the result of a for loop. Consider for > example > > x <- 1; - for > (i in 1:10) x <- x * i > > (? has special semantics, but that is not > noticed at parse time). > =============================================================== > > This is just the sort of thing I love to see posted to the list, > since it is an eye-opener. In fact, to really see what goes on > I had to rub my eyes as follows: > > - for (i in 1:10) print(i) > > and I'm posting it hoping that it will enlighten some other people. > > Best wishes to all, > Ted. > >
Indeed! look at the following: > test <- function(x) invisible(x) > test(9) > - test(9) [1] -9 > Kjetil Halvorsen > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 > (0)870 167 1972 Date: 17-Nov-03 > Time: 15:08:38 ------------------------------ XFMail > ------------------------------ > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help