CoDa_path | R Documentation |

Create a linear path in the simplex by defining a direction and a step size

```
CoDa_path(
comp_direc,
comp_from,
step_size = 0.01,
n_steps = 100,
add_opposite = FALSE,
dir_from_start = FALSE
)
```

`comp_direc` |
A numeric vector, defining a direction in the simplex |

`comp_from` |
A numeric vector, an initial point in the simplex - defaults to a balanced composition, which represents the origin in the simplex |

`step_size` |
A numeric, indicting the step size |

`n_steps` |
A numeric, indicating the number of steps to be taking from |

`add_opposite` |
A logical, if |

`dir_from_start` |
A logical, if |

The function is very similar to `CoDa_seq()`

.
However, of drawing a line between a starting and end point it uses only a starting point and a direction.

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

Lukas Dargel

CoDa_seq

```
# three steps that go from the origin towards the defined direction
comp_direc <- c(A =.4,B = .35, C= .25)
CoDa_path(comp_direc, n_steps = 3)
# we can draw the path that is defined by this direction
comp_direc <- c(A =.4,B = .35, C= .25)
compositions::plot.acomp(CoDa_path(comp_direc,n_steps = 10))
compositions::plot.acomp(CoDa_path(comp_direc,n_steps = 100))
compositions::plot.acomp(CoDa_path(comp_direc,add_opposite = TRUE))
# using the same direction we can draw a new path that does not go through the origin
comp_direc <- c(A =.4,B = .35, C= .25)
comp_from <- c(.7,.2,.1)
compositions::plot.acomp(CoDa_path(comp_direc, comp_from,n_steps = 10))
compositions::plot.acomp(CoDa_path(comp_direc, comp_from,n_steps = 100))
compositions::plot.acomp(CoDa_path(comp_direc, comp_from,add_opposite = TRUE))
# the balanced composition does not define a direction by itself
comp_origin <- c(A = 1/3, B = 1/3, C= 1/3) # corresponds to a zero vector in real space
try(CoDa_path(comp_origin, comp_from,add_opposite = TRUE))
# with the dir_from_start option the direction is derived
# from the simplex line connecting two compositions
path_origin <- CoDa_path(
comp_direc = comp_origin,
comp_from = comp_from,
add_opposite = TRUE,
dir_from_start = TRUE,
step_size = .1)
compositions::plot.acomp(path_origin)
compositions::plot.acomp(comp_origin, add = TRUE, col = "blue", pch = 19)
compositions::plot.acomp(comp_from, add = TRUE, col = "red", pch = 19)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.