momentum_to_wide {distantia} | R Documentation |
Momentum Data Frame to Wide Format
Description
Transforms a data frame returned by momentum()
to wide format with the following columns:
-
most_similar
: name of the variable with the highest contribution to similarity (most negative value in theimportance
column) for each pair of time series. -
most_dissimilar
: name of the variable with the highest contribution to dissimilarity (most positive value in theimportance
column) for each pair of time series. -
importance__variable_name
: contribution to similarity (negative values) or dissimilarity (positive values) of the given variable. -
psi_only_with__variable_name
: dissimilarity of the two time series when only using the given variable. -
psi_without__variable_name
: dissimilarity of the two time series when removing the given variable.
Usage
momentum_to_wide(df = NULL, sep = "__")
Arguments
df |
(required, data frame) Output of |
sep |
(required, character string) Separator between the name of the importance metric and the time series variable. Default: "__". |
Value
data frame
See Also
Other momentum_support:
momentum_aggregate()
,
momentum_boxplot()
,
momentum_model_frame()
,
momentum_spatial()
,
momentum_stats()
Examples
tsl <- tsl_initialize(
x = distantia::albatross,
name_column = "name",
time_column = "time"
) |>
tsl_transform(
f = f_scale_global
)
#importance data frame
df <- momentum(
tsl = tsl
)
df
#to wide format
df_wide <- momentum_to_wide(
df = df
)
df_wide