Re: [R] for loop in R

2017-01-12 Thread jennifer . sheng2002
That is right, Bob. Only one loop for now, since I do not know how to set up the 2nd loop. Any advice from the community? Thank you! Sent from my iPhone > On Jan 12, 2017, at 4:49 PM, Robert Sherry wrote: > > I only see one for loop in your code. I am wondering if you want a second for > l

Re: [R] for loop in R

2017-01-12 Thread Robert Sherry
I only see one for loop in your code. I am wondering if you want a second for loop based upon the length of newdata. I would also think that you do not need the second call to set.seed. Bob On 1/12/2017 4:44 PM, Jennifer Sheng wrote: Dear friends, I am working on a double loop using for. On

Re: [R] "for" loop in R - strange behaviour

2014-01-29 Thread Peter Alspach
Tena koe Not really strange: (7+2):11 is 9:11, 7+2:11 is 7+c(2,3,4,5,6,7,8,9,10,11); i.e., 9:18 Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Supriya Jain Sent: Thursday, 30 January 2014 5:32 a.m. To: r-help@r-

Re: [R] "for" loop in R - strange behaviour

2014-01-29 Thread Duncan Murdoch
On 29/01/2014 11:32 AM, Supriya Jain wrote: Hi, I notice the following from a "for" loop in R, which seems strange to me: When I do this: --- first <- 0 nstep <- 10 N <- 14 while(first < N) { print("---> ") last <- first + nstep if(last > N) last <- N #start <- first+2 f