Re: [R] R - Array data loop selection (Solved)

2012-02-05 Thread David Winsemius
This must be the same poster who reports on SO that _he_ figured out the problem. -- David. On Feb 5, 2012, at 6:01 PM, dengyu19901102 wrote: the structure of ssta_sst can be seen below. dim(ssta_sst) [1] 360 180 362 Also, the debugging for temp is right. The problem for that code is t

Re: [R] R - Array data loop selection

2012-02-05 Thread dengyu19901102
Don't worry, i have figured it out. I forgot the most basic method by adding another increasing loop counter. k=0 for (yr in 1982:2010) { temp <- ssta_sst[,,year_sst==yr & (month_sst>=6 & month_sst<=8)] k=k+1 for (i in 1:360) { for (j in 1:180) {

Re: [R] R - Array data loop selection

2012-02-05 Thread dengyu19901102
the structure of ssta_sst can be seen below. > dim(ssta_sst) [1] 360 180 362 Also, the debugging for temp is right. The problem for that code is the temp doesn't pass down as it suppose to be, it only gives the last value in 2010. > for (yr in 1982:2010) { + temp <- ssta_sst[,,year_sst==yr & (mo

Re: [R] R - Array data loop selection

2012-02-05 Thread David Winsemius
On Feb 4, 2012, at 8:29 PM, dengyu19901102 wrote: i want to select June, July and August data from the 3D array (`ssta_sst`, 360*180*362). the loop works but the output of ssta_winter has the identical values for `ssta_winter[,,i]`.seen below. I have set it up as an array of (360,180,29)