coeff_rearrange | R Documentation |
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.
coeff_rearrange(x, by = c("name", "rank")[1])
x |
matrix (with colnames) |
by |
character either "name" ( |
a Momocs object of same class
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.