hey guys, I am very new to Rstudio and need help with my code
I want to create a time-sequence of means (means are spatial) for a specific height. [x,y,z,time]
The code below is the description what I want to code, so that I don't have to calculate every timestep and mean:
A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here.
The problem is really general, but I can try to describe it more or create some sample dataset (my own way):
I have a large array for the sensible heat flux ("wt") for 396m height (or level z=34) [x,y,z,t]=[5, 5, 34, time] and an area of (5x30)x(5x30) m².
With wtt1 <- wt[,,34,1] I get the wt for the first timestep as matrix
[,1] [,2] [,3] [,4] [,5]
[1,] 3.451702 3.954215 4.123870 3.977466 3.646228
[2,] 2.664010 3.311872 3.894432 4.028738 3.971135
[3,] 2.341531 2.815181 3.415749 3.742354 3.767889
[4,] 2.337046 2.675287 3.058318 3.548073 3.738639
[5,] 2.761136 3.085854 3.245972 3.517346 3.604163
then mean(wtt1)
but I want to calculate it for every timestep and create a sequence of these means
in the end there will only be a sequence of wt_mean over time