MSHAPES {Momocs} | R Documentation |
Mean shape calculation for Coo, Coe, etc.
Description
Quite a versatile function that calculates mean (or median, or whatever function)
on list or an array of shapes, an Ldk object. It can also be used on Coe objects.
In that case, the reverse transformation (from coefficients to shapes) is calculated, (within
groups defined with the fac argument if provided) and the Coe object is also returned
(in $Coe
) along with a list of shapes (in $shp
) and can then be passed to plot_MSHAPES
.
Usage
MSHAPES(x, fac = NULL, FUN = mean, nb.pts = 120, ...)
Arguments
x |
a list, array, Ldk, LdkCoe, OutCoe or OpnCoe or PCA object |
fac |
factor specification for fac_dispatcher |
FUN |
a function to compute the mean shape (mean by default, by median can be considered) |
nb.pts |
numeric the number of points for calculated shapes (only Coe objects) |
... |
useless here. |
Value
the averaged shape; on Coe objects, a list with two components: $Coe
object of the same class, and
$shp
a list of matrices of (x, y) coordinates. On PCA and LDA objects, the FUN (typically mean or median)
of scores on PCs
or LDs
. This method used on the latter objects may be moved to another function at some point.
See Also
Other multivariate:
CLUST()
,
KMEANS()
,
KMEDOIDS()
,
LDA()
,
MANOVA_PW()
,
MANOVA()
,
MDS()
,
NMDS()
,
PCA()
,
classification_metrics()
Examples
#### on shapes
MSHAPES(wings)
MSHAPES(wings$coo)
MSHAPES(coo_sample(bot, 24)$coo)
stack(wings)
coo_draw(MSHAPES(wings))
bot.f <- efourier(bot, 12)
MSHAPES(bot.f) # the mean (global) shape
ms <- MSHAPES(bot.f, 'type')
ms$Coe
class(ms$Coe)
ms <- ms$shp
coo_plot(ms$beer)
coo_draw(ms$whisky, border='forestgreen')