Learn R Programming

CoDaImpact (version 0.1.0)

CoDa_seq: A sequence connecting two points in a simplex

Description

A sequence connecting two points in a simplex

Usage

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

Value

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

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

Author

Lukas Dargel

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

Examples

Run this code

# 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))
compositions::plot.acomp(CoDa_seq(start_comp, end_comp,add_opposite = TRUE))

Run the code above in your browser using DataLab