[R] simple question on loop

2012-11-16 Thread billycorg
Hi R Users. I have a simple question on a loop. The following loop works fine: r_t=list() for(i in 1:500) { r_t[[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[i,]) } But indeed I need also that *z_t_m* varies. Let us suppose that *z_t_m* has 1000 replicates, I have written the following loop that

Re: [R] simple question on loop

2012-11-16 Thread Suzen, Mehmet
Use mapply instead On Fri, Nov 16, 2012 at 5:01 PM, billycorg candi...@gmail.com wrote: Hi R Users. I have a simple question on a loop. The following loop works fine: r_t=list() for(i in 1:500) { r_t[[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[i,]) } But indeed I need also that *z_t_m*