Description Usage Arguments Value Examples
View source: R/leastCostPath.R
Uses the original distance matrix created by distanceMatrix
and the least cost path matrix created by leastCostMatrix
to find the least cost path between the first and the last cells of the matrix. If diagonal
was TRUE
in leastCostMatrix
, then it must be TRUE
when using this function. Otherwise, the default is FALSE
in both.
1 2 3 4 5 6  leastCostPath(
distance.matrix = NULL,
least.cost.matrix = NULL,
diagonal = FALSE,
parallel.execution = TRUE
)

distance.matrix 
numeric matrix or list of numeric matrices, a distance matrix produced by 
least.cost.matrix 
numeric matrix or list of numeric matrices produced by 
diagonal 
boolean, if 
parallel.execution 
boolean, if 
Alist of dataframes if least.cost.matrix
is a list, or a dataframe if least.cost.matrix
is a matrix. The dataframe/s have the following columns:
A row/sample of one of the sequences.
B row/sample of one the other sequence.
distance distance between both samples, extracted from distance.matrix
.
cumulative.distance cumulative distance at the samples A
and B
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  #loading data
data(sequenceA)
data(sequenceB)
#preparing datasets
AB.sequences < prepareSequences(
sequence.A = sequenceA,
sequence.A.name = "A",
sequence.B = sequenceB,
sequence.B.name = "B",
merge.mode = "complete",
if.empty.cases = "zero",
transformation = "hellinger"
)
#computing distance matrix
AB.distance.matrix < distanceMatrix(
sequences = AB.sequences,
grouping.column = "id",
method = "manhattan",
parallel.execution = FALSE
)
#computing least cost matrix
AB.least.cost.matrix < leastCostMatrix(
distance.matrix = AB.distance.matrix,
diagonal = FALSE,
parallel.execution = FALSE
)
AB.least.cost.path < leastCostPath(
distance.matrix = AB.distance.matrix,
least.cost.matrix = AB.least.cost.matrix,
parallel.execution = FALSE
)
#plot
plotMatrix(distance.matrix = AB.distance.matrix,
least.cost.path = AB.least.cost.path,
)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.