Re: [R] LOOping problem with R

2010-08-30 Thread Berend Hasselman
You made a mistake with theta theta<-c(0.08,0.06,0.09,0) This should be (see the fortran) theta<-c(0.06,0.08,0.09,0) The innermost loop (for( k in ...) is better written as while loop to take into account how Fortran handles loops (see the previous replies): k <- i while( k <=

Re: [R] LOOping problem with R

2010-08-29 Thread Joshua Wiley
Hi, I would also like to point out that you flipped the first two the values of theta in the R vs. FORTRAN versions. This fixes part of your differences (and makes it easy to see that the differences occur when j < i, as David and Mario point out). Josh On Sun, Aug 29, 2010 at 10:27 PM, Nam Let

Re: [R] LOOping problem with R

2010-08-29 Thread Mario Valle
When j==1 for loops from i down to zero. 5:0 is valid and means c(5,4,3,2,1,0) Hope it helps mario Nam Lethanh wrote: > Dear Guys, > > I do converting codes from Fortran into R and got stuck in solving LOOPING > procedure with R. In FORTRAN, it is (DO and END DO) for loopi

Re: [R] LOOping problem with R

2010-08-29 Thread David Winsemius
On Aug 30, 2010, at 1:27 AM, Nam Lethanh wrote: Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). Looking at the results (namely the 1's from t

[R] LOOping problem with R

2010-08-29 Thread Nam Lethanh
Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). I believe there is something wrong with my coding in R, do hope that you can help me solving following pr