[R] ?for

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Nov 17 11:49:37 CET 2003


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> You have typed a syntactically incomplete statement: this is explained in 
> ?help.
> 
> Hint: ?"for" and help("for") work.

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).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list