Skip to contents

A sequence connecting two points in a simplex

Usage

CoDa_seq(comp_from, comp_to, n_steps = 100, add_opposite = FALSE)

Arguments

comp_from

A numeric vector, representing the initial compositions

comp_to

A numeric vector, representing the final compositions.

n_steps

An integer, indicating the number of steps used to go from comp_from to comp_to

add_opposite

A logical, if TRUE the path in the opposite direction is added

Value

A data.frame frame where each row corresponds to one compositional vector

Details

The sequence is evenly spaced and corresponds to a straight line in the simplex geometry. If no end point is provided the line will connect the initial point with the first summit of the simplex. Since exact zeros are not handled by the ilr they are replaced by a small constant.

See also

simplex_increment

Author

Lukas Dargel

Examples


# path to the first summit of the simplex
start_comp <- c(A =.4,B = .35, C= .25)
compositions::plot.acomp(CoDa_seq(start_comp))

compositions::plot.acomp(CoDa_seq(start_comp, add_opposite = TRUE))


# path to an edge of the simplex
end_comp <- c(0,.8,.2)
compositions::plot.acomp(CoDa_seq(start_comp, end_comp))
#> Warning: Zero values in `comp_from` or `comp_to` are not permitted and were replaced by 1e-10!'

compositions::plot.acomp(CoDa_seq(start_comp, end_comp,add_opposite = TRUE))
#> Warning: Zero values in `comp_from` or `comp_to` are not permitted and were replaced by 1e-10!'