Skip to contents

Internal function to convert a distantia data frame into a matrix.

Usage

utils_distantia_df_to_matrix(df = NULL, x = "x", y = "y", value = "psi")

Arguments

df

(required, data frame) data frame typically resulting from distantia(), but others are accepted as long as the columns x, y, and value are available. Default: NULL

x

(required, character string) Name of the column with the names of the matrix columns. Default: "x"

y

(required, character string) Name of the column with the names of the matrix rows. Default: "y"

value

(required, character string) Name of the column with values.

Value

dist matrix

Examples

tsl <- tsl_simulate(
  n = 3,
  time_range = c(
    "2010-01-01 12:00:25",
    "2024-12-31 11:15:45"
  )
)

df <- distantia(
  tsl = tsl
)

m <- utils_distantia_df_to_matrix(
  df = df
)

m
#>          A        B        C
#> A 0.000000 2.653952 5.019716
#> B 2.653952 0.000000 5.251595
#> C 5.019716 5.251595 0.000000