Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7404811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:18:34+00:00 2026-05-29T05:18:34+00:00

i want to select June, July and August data from the 3D array (

  • 0

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).

I think the problem is the variable temp, i want to define it as an array first but i don’t know what 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
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
[1] 0.2222583
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:18:34+00:00Added an answer on May 29, 2026 at 5:18 am

    This : mean(temp[i,j,]) will only produce a single value, so the LHS of that assignment should be ssta_winter[i,j], and that means your dimensions for the means of winter (in the Southern Hemisphere) months should be only c(360,180). (And that explains the pattern you are puzzled by.)

    If you want a single value for the “year” index, then you need to use that seq_along applied to the index inside your loop on the LHS of the assingment:

    for (yr in seq_along(1982:2010 ) ) {
       temp <- ssta_sst[,,year_sst==(1982:2010)[yr] & (month_sst>=6 & month_sst<=8)]
       for (i in 1:360) {
         for (j in 1:180) {
            ssta_winter[i,j,yr] <- mean(temp[i,j,])
                                       }
                         }
                          }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have users table and i have posts table i want select from users
I want to SELECT a formatted date string from a datetime type in SQL
I want to select data between 1 week ago data until today data: SELECT
I want select auto radio button with Greasemonkey. But I want select radio with
I have a stored procedure to get the data I want: SELECT a.SONum, a.Seq1,
I want select multiple (all) values from table Account. string query = SELECT *
I want to select varchar within date. I already tried code below but it
Can anybody help me with this: I want select all records from datatable which
Hello everyone i want search data from invoices and client by today date I'm
I want to select the topmost element in a document that has a given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.