workflowPsi.Rd
If the sequences are not aligned (paired.samples = FALSE
), the function executes these steps.
Computes the autosum of the sequences with autoSum
.
Computes the distance matrix with distanceMatrix
.
Uses the distance matrix to compute the least cost matrix with leastCostMatrix
.
Extracts the cost of the least cost path with leastCost
.
Computes the dissimilarity measure psi with the function psi
.
Delivers an output of type "list" (default), "data.frame" or "matrix", depending on the user input, through formatPsi
.
If the sequences are aligned (paired.samples = TRUE
), these steps are executed:
Computes the autosum of the sequences with autoSum
.
Sums the distances between paired samples with distancePairedSamples
.
Computes the dissimilarity measure psi with the function psi
.
Delivers an output of type "list" (default), "data.frame" or "matrix", depending on the user input, through formatPsi
.
workflowPsi(
sequences = NULL,
grouping.column = NULL,
time.column = NULL,
exclude.columns = NULL,
method = "manhattan",
diagonal = FALSE,
format = "dataframe",
paired.samples = FALSE,
same.time = FALSE,
ignore.blocks = FALSE,
parallel.execution = TRUE
)
dataframe with multiple sequences identified by a grouping column generated by prepareSequences
.
character string, name of the column in sequences
to be used to identify separates sequences within the file.
character string, name of the column with time/depth/rank data.
character string or character vector with column names in sequences
to be excluded from the analysis.
character string naming a distance metric. Valid entries are: "manhattan", "euclidean", "chi", and "hellinger". Invalid entries will throw an error.
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. If paired.samples
is TRUE
, then diagonal
is irrelevant.
string, type of output. One of: "data.frame", "matrix". If NULL
or empty, a list is returned.
boolean, if TRUE
, the sequences are assumed to be aligned, and distances are computed for paired-samples only (no distance matrix required). Default value is FALSE
.
boolean. If TRUE
, samples in the sequences to compare will be tested to check if they have the same time/age/depth according to time.column
. This argument is only useful when the user needs to compare two sequences taken at different sites but same time frames.
boolean. If TRUE
, the function leastCostPathNoBlocks
analyzes the least-cost path of the best solution, and removes blocks (straight-orthogonal sections of the least-cost path), which happen in highly dissimilar sections of the sequences, and inflate output psi values.
boolean, if TRUE
(default), execution is parallelized, and serialized if FALSE
.
A list, matrix, or dataframe, with sequence names and psi values.
# \donttest{
data("sequencesMIS")
#prepare sequences
MIS.sequences <- prepareSequences(
sequences = sequencesMIS,
grouping.column = "MIS",
if.empty.cases = "zero",
transformation = "hellinger"
)
#execute workflow to compute psi
MIS.psi <- workflowPsi(
sequences = MIS.sequences[MIS.sequences$MIS %in% c("MIS-1", "MIS-2"), ],
grouping.column = "MIS",
time.column = NULL,
exclude.columns = NULL,
method = "manhattan",
diagonal = FALSE,
parallel.execution = FALSE
)
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
MIS.psi
#> A B psi
#> 1 MIS-1 MIS-2 Inf
# }