I have a list that contain matrix named from 1 to 10 each one represent a year, so i have to generate matrix MG between M1 and M2, also between M2 et M3, M3 et M4....
so for example to calculate matrix betweem M1 and M2 i have to do this following calculation:
L=c(rowSums(Matrix1)) #(sum of each matrix'row)
K=c(rowSums(MatriX2))
G=L+K
SM=Matrix1+Matrix2 #( sum of the two matrix)
MG=sweep(SM,1,G,FUN = "/") #( div SM by G )
output=list(MG)
and at the end generate a matrix that calculate the mean of all the MG included in the list.
I'm still new in R, any help would be appreciated thanks