[R] R - Array data loop selection

dengyu19901102 a1204342 at student.adelaide.edu.au
Mon Feb 6 00:01:23 CET 2012


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 & (month_sst>=6 & month_sst<=8)]
+ print((temp[180,150,]))
+ }
[1] -0.1222553 -1.1918445 -1.4373364
[1] 0.1633172 0.4173717 0.3046455
[1] -0.09144592 -0.07893944  0.17008305
[1] -0.4625878 -0.8130879 -0.1483498
[1]  0.4427924  0.3539629 -0.3874750
[1]  0.01041174 -0.09124422 -0.21673584
[1] -0.6023500 -0.7302761 -0.5943871
[1] 0.7994118 0.8654838 1.2745066
[1]  0.7604122  0.9056220 -0.1608391
[1] -0.4728267  0.1472344  0.8778248
[1] -0.03596878 -0.62659025 -0.76669025
[1] 0.4236970 0.1917505 0.2345533
[1] -0.4878743 -0.6475577 -0.3501463
[1] 0.385983 1.195161 1.000176
[1] 0.80145884 0.07995319 0.38713264
[1] 1.6643634 0.9049325 1.2965355
[1] -1.8980644 -0.9165435 -0.8992710
[1] -0.53620720  0.00331831 -0.82572365
[1] 1.2336969 1.4409213 0.8177786
[1] 0.8724594 0.4335489 0.1698532
[1] 0.2958407 0.1884332 0.3601770
[1] 1.112364 2.372303 2.139807
[1] 2.492840 2.800321 1.996305
[1] 1.046745 1.335898 1.245474
[1] 0.6113644 0.9268212 1.2416964
[1] 1.220745 1.864054 1.566535
[1] -0.5436361  0.4582486  1.8623419
[1]  0.1931739 -0.5358076 -0.1318054
[1] 0.4009829 0.8228106 0.9057512


--
View this message in context: http://r.789695.n4.nabble.com/R-Array-data-loop-selection-tp4358282p4359994.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list