Learn R Programming

exactLTRE (version 0.1.2)

mean_matrix: Calculate the mean matrix

Description

Calculate the mean matrix from a list of matrices. In the mean matrix, each element of the matrix is the mean value at that indexed position, across all the provided matrices.

Usage

mean_matrix(Aobj)

Value

A single population projection matrix, with the same dimensions as the provided ones, where all vital rate entries are the mean across all provided matrices at the respective matrix index.

Arguments

Aobj

A list of matrix population models, which must all have the same dimensions.

Examples

Run this code
A1<- matrix(data=c(0,0.8,0, 0,0,0.7, 5,0,0.2), nrow=3, ncol=3)
A2<- matrix(data=c(0,0.9,0, 0,0,0.5, 4,0,0.3), nrow=3, ncol=3)
A3<- matrix(data=c(0,0.4,0, 0,0,0.6, 6,0,0.25), nrow=3, ncol=3)
Amean<- mean_matrix(list(A1,A2,A3))

Run the code above in your browser using DataLab