Re: [R] Question Regarding a nested for loop in R

2015-12-04 Thread MCGUIRE, Rhydwyn
-project.org Subject: [R] Question Regarding a nested for loop in R Hello there, I'm an R novice and am trying to figure out how to create an external for loop. My current loop iterates 15 times and stores the resulting values in 3 separate vectors. What I need is to create an outside loop

Re: [R] Question Regarding a nested for loop in R

2015-12-04 Thread MacQueen, Don
I'll hope this isn't homework (R-help has a "don't do people's homework for them" convention), and make a few suggestions. The inner loop is not needed. For example, you can replace for (i in 1:15 ) { Inv1Outcome[i] = if (random[i] <= .25){Inv1Returns[1]} else if (random[i] > .25 & random[i]

Re: [R] Question Regarding a nested for loop in R

2015-12-03 Thread David Winsemius
> On Dec 3, 2015, at 2:42 PM, Vermilio, Ryan wrote: > > Hello there, > > I'm an R novice and am trying to figure out how to create an external for > loop. My current loop iterates 15 times and stores the resulting values in 3 > separate vectors. What I need is

[R] Question Regarding a nested for loop in R

2015-12-03 Thread Vermilio, Ryan
Hello there, I'm an R novice and am trying to figure out how to create an external for loop. My current loop iterates 15 times and stores the resulting values in 3 separate vectors. What I need is to create an outside loop that will run internal loop 4 times, sum the resulting vectors for