[R] A suggestion regarding multiple replies

kjetil@entelnet.bo kjetil at entelnet.bo
Mon Nov 17 18:52:08 CET 2003


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 <p.dalgaard at biostat.ku.dk> > To: Angel
> <angel_lul at hotmail.com>, r-help at stat.math.ethz.ch > 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) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44
> (0)870 167 1972 Date: 17-Nov-03                                  
> Time: 15:08:38 ------------------------------ XFMail
> ------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list