Skip to contents

Internal function to split a distantia data frame by groups of the arguments 'distance', 'diagonal', 'weighted', 'ignore_blocks', 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 weighted ignore_blocks lock_step       x      y       psi
#> 4 euclidean     TRUE     TRUE         FALSE      TRUE Germany  Spain 1.3962157
#> 5 euclidean     TRUE     TRUE         FALSE      TRUE Germany Sweden 0.8364652
#> 6 euclidean     TRUE     TRUE         FALSE      TRUE   Spain Sweden 1.5703931
#>   group
#> 4     1
#> 5     1
#> 6     1
#> 
#> $`2`
#>     distance diagonal weighted ignore_blocks lock_step       x      y       psi
#> 10 manhattan     TRUE     TRUE         FALSE      TRUE Germany  Spain 1.3737381
#> 11 manhattan     TRUE     TRUE         FALSE      TRUE Germany Sweden 0.8271986
#> 12 manhattan     TRUE     TRUE         FALSE      TRUE   Spain Sweden 1.5755002
#>    group
#> 10     2
#> 11     2
#> 12     2
#> 
#> $`3`
#>    distance diagonal weighted ignore_blocks lock_step       x      y       psi
#> 1 euclidean     TRUE     TRUE         FALSE     FALSE Germany  Spain 1.0360268
#> 2 euclidean     TRUE     TRUE         FALSE     FALSE Germany Sweden 0.7285701
#> 3 euclidean     TRUE     TRUE         FALSE     FALSE   Spain Sweden 1.0237508
#>   group
#> 1     3
#> 2     3
#> 3     3
#> 
#> $`4`
#>    distance diagonal weighted ignore_blocks lock_step       x      y      psi
#> 7 manhattan     TRUE     TRUE         FALSE     FALSE Germany  Spain 1.134012
#> 8 manhattan     TRUE     TRUE         FALSE     FALSE Germany Sweden 0.761250
#> 9 manhattan     TRUE     TRUE         FALSE     FALSE   Spain Sweden 1.166331
#>   group
#> 7     4
#> 8     4
#> 9     4
#> 

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