How to Sum a List of Matrices in R (Example) | Add Values of Matrix Object | Apply Reduce() Function

preview_player
Показать описание
R code of this video:

my_list <- list(mat1 = matrix(1:16, ncol = 4), # Create example list of matrices
mat2 = matrix(11:26, ncol = 4),
mat3 = matrix(101:116, ncol = 4))
my_list # Print example list of matrices

list_sum <- Reduce("+", my_list) # Calculate sum of matrices
list_sum # Print sum of matrices

Follow me on Social Media:

Рекомендации по теме
welcome to shbcf.ru