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) { ssta_winter[i,j,k] <- mean(temp[i,j,]) } } } -- View this message in context: http://r.789695.n4.nabble.com/R-Array-data-loop-selection-tp4358282p4360028.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.