| coeff_rearrange {Momocs} | R Documentation |
Rearrange a matrix of (typically Fourier) coefficients
Description
Momocs uses colnamed matrices to store (typically) Fourier coefficients
in Coe objects (typically OutCoe). They are arranged as rank-wise:
A1, A2, ..., An, B1, ..., Bn, C1, ..., Cn, D1, ..., Dn. From other softwares they may arrive
as A1, B1, C1, D1, ..., An, Bn, Cn, Dn, this functions helps to go
from one to the other format. In short, this function rearranges column order. See examples.
Usage
coeff_rearrange(x, by = c("name", "rank")[1])
Arguments
x |
matrix (with colnames) |
by |
character either "name" ( |
Value
a Momocs object of same class
Examples
m_name <- m_rank <- matrix(1:32, 2, 16)
# this one is ordered by name
colnames(m_name) <- paste0(rep(letters[1:4], each=4), 1:4)
# this one is ordered by rank
colnames(m_rank) <- paste0(letters[1:4], rep(1:4, each=4))
m_rank
m_rank %>% coeff_rearrange(by="name")
m_rank %>% coeff_rearrange(by="rank") #no change
m_name
m_name %>% coeff_rearrange(by="name") # no change
m_name %>% coeff_rearrange(by="rank")
[Package Momocs version 1.4.1 Index]