I've got a list of more than 6000 dataframes with about 6000 observations of 2000 variables. I would like to calculate a mean dataframe of 6000x2000 in which each value is the mean of that same position across all dataframes (as example: mean.df[1,1] = mean(df1[1,1],df2[1,1],df3[1,1],.....dfN[1,1])
I've prepared a short example to illustrate what I need
# Build list of dataframes
df.X <- data.frame("A1" = seq(1,5,1), "A2" = seq(2,10,2) , "A3" = seq(10,18,2))
df.Y <- data.frame("B1" = seq(0,8,2), "B2" = seq(4,8,1) , "B3" = seq(10,18,2))
df.Z <- data.frame("C1" = seq(2,10,2), "C2" = 1:5 , "C3" = seq(10,18,2))
df.list <- list(df.X,df.Y,df.Z)
#Desired output
m1 M2 M3
1.0 2.3 10.0
2.7 3.7 12.0
4.3 5.0 14.0
6.0 6.3 16.0
7.7 7.7 18.0
I have made some attempts with purrr with reduce and map but had no success. Mabye apply?
Thanks in advance