mpm_mean | R Documentation |
Calculates an element-wise mean over a list of matrices or CompadreMat objects of constant dimension.
The difference between function mat_mean
) and (mpm_mean
is that
mat_mean
takes input as a list of matrices (e.g., a list of **A**
matrices) while mat_mean
takes input as a list of 'CompadreMat' objects and
thus calculates the mean matrices for both the **A** matrix and its
submatrices (**U**, **F**, **C**).
mat_mean(x, na.rm = FALSE)
mpm_mean(x, na.rm = FALSE)
x |
A list of matrices or, for |
na.rm |
Logical indicating whether missing values should be excluded
(see Details). Defaults to |
If na.rm == TRUE
, missing values are ignored in the calculation of the
mean matrix. If na.rm == TRUE
and a given element is NA
in
every matrix within x
, the value returned for that element will
be 0
.
A matrix (mat_mean
) or a CompadreMat object (mpm_mean
).
Patrick Barks <patrick.barks@gmail.com>
Owen R. Jones <jones@biology.sdu.dk>
Other data management:
cdb_flatten()
,
cdb_id_stages()
,
cdb_id_studies()
,
cdb_id()
,
cdb_mean_matF()
,
cdb_rbind()
,
cdb_unflatten()
,
cdb_unnest()
,
mpm_median()
,
mpm_sd()
,
string_representation
# there are four rows for species 'Haplopappus_radiatus' in Compadre
mpms <- Compadre$mat[Compadre$SpeciesAuthor == "Haplopappus_radiatus"]
#The object mpms is a list, containing compadre objects
class(mpms)
class(mpms[[1]])
mpm_mean(mpms)
# extract list of matA and take mean
mats <- matA(mpms)
mat_mean(mats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.