[R] for loop question
HEUMANN,JOHN (A-Loveland,ex1)
john_heumann at agilent.com
Tue Sep 11 20:54:49 CEST 2001
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 ????
>
Conversely, the following behaves as expected:
> for (i in 1:2) {
+ k <- i+1
+ for (j in k:3) {
+ print(j)
+ }
+ }
[1] 2
[1] 3
[1] 3
>
This is under NT4, SP5 using a pre-compiled binary from CRAN.
Thanks,
-jh-
=========================================
John M. Heumann, Agilent Technologies
815 14th St. S.W., Loveland, CO 80537 USA
Email: john_heumann at agilent.com
Phone: 970 679-3761 FAX: 970 679-5399
=========================================
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list