Description Usage Arguments Value
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.
1 | .loadMatrixFromDF(dataframe, value.var, diag, unidirectional = TRUE)
|
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). |
a symmetric matrix with rownames(mat) == colnames(mat) The diagonal values are filled with diag if the dataframe itself doesn't have diagonal data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.