Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.33.0109111242350.62078-100000@homer16.u.washington.edu>
Date: 2001-09-11T19:43:50Z
From: Thomas Lumley
Subject: for loop question
In-Reply-To: <9153F74610B7D311B83900902771C8710A4CE336@axcs07.cos.agilent.com>

On Tue, 11 Sep 2001, HEUMANN,JOHN (A-Loveland,ex1) wrote:

> In the windows version of R (1.3.0) is the following a bug, a
> known problem, or expected behavior:
>
>  > for (i in 1:2) {
>  + for (j in i+1:3) {
>  + print(j)
>  + }
>  + }
>  [1] 2
>  [1] 3
>  [1] 4      ????
>  [1] 3
>  [1] 4      ????
>  [1] 5      ????
>  >


It's expected behaviour (if you expect it)

Try
  i<-1
  i+1:3
  (i+1):3

to see what is going on


	-thomas


Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._