How can I sum one specific column in all data frames in a list an put them in a new data frame? An small example is:
A <- data.frame(matrix( nrow = 2, ncol = 2))
B <- data.frame(matrix( nrow = 2, ncol = 2))
A[,] <- 3
B[,] <- 4
l <- list(A,B)
So let's say I want to sum up all columns "X1" in my list and put in one data frame (vector, since there only should be one row). This data frame should then have value 6 (3+3) in first row and 8 (4+4) in the second.
In the real data I have 18 data frames in the list and the columns to sum in each data frame is of different lenght.
Mabye I should use the sapply
or lapply
function?