Learn R Programming

Momocs (version 1.4.1)

coeff_sel: Helps to select a given number of harmonics from a numerical vector.

Description

coeff_sel helps to select a given number of harmonics by returning their indices when arranged as a numeric vector. For instance, harmonic coefficients are arranged in the $coe slot of Coe-objects in that way: \(A_1, \dots, A_n, B_1, \dots, B_n, C_1, \dots, C_n, D_1, \dots, D-n\) after an elliptical Fourier analysis (see efourier and efourier) while \(C_n and D_n\) harmonic are absent for radii variation and tangent angle approaches (see rfourier and tfourier respectively). . This function is used internally but might be of interest elwewhere.

Usage

coeff_sel(retain = 8, drop = 0, nb.h = 32, cph = 4)

Value

coeff_sel returns indices that can be used to select columns from an harmonic coefficient matrix. coeff_split returns a named list of coordinates.

Arguments

retain

numeric. The number of harmonics to retain.

drop

numeric. The number of harmonics to drop

nb.h

numeric. The maximum harmonic rank.

cph

numeric. Must be set to 2 for rfourier and tfourier were used.

Examples

Run this code
bot.f <- efourier(bot, 32)
coe <- bot.f$coe # the raw matrix
coe
# if you want, say the first 8 harmonics but not the first one
retain <- coeff_sel(retain=8, drop=1, nb.h=32, cph=4)
head(coe[, retain])

Run the code above in your browser using DataLab