leastCostPath.Rd
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.
leastCostPath(
distance.matrix = NULL,
least.cost.matrix = NULL,
diagonal = FALSE,
parallel.execution = TRUE
)
numeric matrix or list of numeric matrices, a distance matrix produced by distanceMatrix
.
numeric matrix or list of numeric matrices produced by leastCostMatrix
.
boolean, if TRUE
, diagonals are included in the computation of the least cost path. Defaults to FALSE
, as the original algorithm did not include diagonals in the computation of the least cost path.
boolean, if TRUE
(default), execution is parallelized, and serialized if FALSE
.
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
.
# \donttest{
#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,
#)
# }