I have a list of 1800 matrices that have dimensions 7 x 7. I'm trying to obtain the elements of the first 2 rows and columns and turn it into a list of 2 x 2 matrices before doing a Map multiplication on them to finally replace the values on the original list of 7 x 7 matrices.
The code I have is:
PreMultiply_matrixList <- list()
PreMultiply_matrixList <- sapply(Probability_matrixList, "[", c(1:2),c(1:2))
Where the Probability_matrixList is the list of 7 x 7 matrices.
However, the PreMultiply_matrixList just seems to have copied the first element of each matrix, rather than a 2x2 matrix.
I have also tried similar codes from different posts such as:
PreMultiply_matrixList <- sapply(Probability_matrixList,"[",1:2,1:2)
How would you go about it? Then after multiplying (using Map) with another list and then replacing the values on the original Probability_matrixList?
Thanks in advance.