Skip to contents

Internal function to split a distantia data frame by groups of the arguments 'distance', 'diagonal', and 'lock_step'.

Usage

utils_distantia_df_split(df = NULL)

Arguments

df

(required, data frame) Output of distantia() or distantia_aggregate(). Default: NULL

Value

list

Examples

#three time series
#climate and ndvi in Fagus sylvatica stands in Spain, Germany, and Sweden
tsl <- tsl_initialize(
  x = fagus_dynamics,
  name_column = "name",
  time_column = "time"
)

#dissimilarity analysis with four combinations of parameters
df <- distantia(
  tsl = tsl,
  distance = c(
    "euclidean",
    "manhattan"
    ),
  lock_step = c(
    TRUE,
    FALSE
  )
)

#split by combinations of parameters
df_split <- utils_distantia_df_split(
  df = df
)

#print output
df_split
#> $`1`
#>    distance diagonal lock_step       x      y bandwidth       psi group
#> 1 euclidean     TRUE     FALSE Germany Sweden         1 0.7285701     1
#> 2 euclidean     TRUE     FALSE Germany  Spain         1 1.0360268     1
#> 3 euclidean     TRUE     FALSE   Spain Sweden         1 1.0237508     1
#> 
#> $`2`
#>    distance diagonal lock_step       x      y bandwidth      psi group
#> 7 manhattan     TRUE     FALSE Germany  Spain         1 1.134012     2
#> 8 manhattan     TRUE     FALSE   Spain Sweden         1 1.166331     2
#> 9 manhattan     TRUE     FALSE Germany Sweden         1 0.761250     2
#> 
#> $`3`
#>     distance diagonal lock_step       x      y bandwidth       psi group
#> 10 manhattan     TRUE      TRUE Germany Sweden         1 0.8271986     3
#> 11 manhattan     TRUE      TRUE   Spain Sweden         1 1.5755002     3
#> 12 manhattan     TRUE      TRUE Germany  Spain         1 1.3737381     3
#> 
#> $`4`
#>    distance diagonal lock_step       x      y bandwidth       psi group
#> 4 euclidean     TRUE      TRUE Germany  Spain         1 1.3962157     4
#> 5 euclidean     TRUE      TRUE   Spain Sweden         1 1.5703931     4
#> 6 euclidean     TRUE      TRUE Germany Sweden         1 0.8364652     4
#> 

#class and length of the output
class(df_split)
#> [1] "list"
length(df_split)
#> [1] 4