Displaying 1 result from an estimated 1 matches for "year_sst".
Did you mean:
year_dat
2012 Feb 05
1
R - Array data loop selection
...size it should be (360,180,3) or (360,180,3*29)
and how to keep a loop counter in `temp` when it passes down to finding mean
stage?
ssta_winter = array( data=NA, dim = c(360,180,29))
temp = array( data=NA, dim = c(360,180,3))
for (yr in 1982:2010) {
temp <- ssta_sst[,,year_sst==yr & (month_sst>=6 & month_sst<=8)]
for (i in 1:360) {
for (j in 1:180) {
ssta_winter[i,j,] <- mean(temp[i,j,])
}
}
}
> for (i in 1:29){
+ print(ssta_winter[180,166,i])
+ }
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[...