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 3.408875 4.133979
#> B 3.408875 0.000000 4.781276
#> C 4.133979 4.781276 0.000000