.loadMatrixFromDF {abseqR} | R Documentation

## Given a dataframe with the columns "from", "to", and value.var, return a symmetric matrix (with diagonal values = diag). I.e. a call to isSymmetric(return_value_of_this_function) will always be TRUE.

### Description

Given a dataframe with the columns "from", "to", and value.var, return a symmetric matrix (with diagonal values = diag). I.e. a call to isSymmetric(return_value_of_this_function) will always be TRUE.

### Usage

    .loadMatrixFromDF(dataframe, value.var, diag, unidirectional = TRUE)

### Arguments

`dataframe` | dataframe with 3 required columns, namely: +—————————————+ | from | to | value.var | ... | +—————————————+ | | | | | +—————————————+ where value.var is the string provided in the function parameter
`value.var` | the column to use as the matrix value
`diag` | what should the diagonal values be if the dataframe doesn't provide them
`unidirectional` | logical type. If the dataframe provided has the reverse pairs (i.e. a from-to pair AND a to-from pair with the save values in the value.var column), then this should be FALSE. Otherwise, this function will flip the from-to columns to generate a symmetric dataframe (and hence, a symmetric matrix).

### Value

a symmetric matrix with rownames(mat) == colnames(mat) The diagonal values are filled with diag if the dataframe itself doesn't have diagonal data

[Package abseqR version 1.4.0 Index]