[R] for loop doesn't stop with upper loop value
Rolf Turner
r.turner at auckland.ac.nz
Wed Jul 4 03:40:09 CEST 2007
On 4/07/2007, at 12:01 PM, <Alexander.Herr at csiro.au>
<Alexander.Herr at csiro.au> wrote:
> Hi list,
>
> could anyone please educate me on the following:
>
> lst<-seq(47, 239, by=12)
>
> for(n in lst)
> {
> lower=n; upper=lower+10
> for(i in lower+2 : upper)
> {
> print(paste(n, " i: ", i, " lower: ",lower, " upper :", upper))
> }
> }
>
> does not stop when i = upper
To see what's going on, type
239+2:249
Hints:
o precedence of operators (this ain't APL)
o parentheses are Good Things.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confidenti...{{dropped}}
More information about the R-help
mailing list