make_long_form: Make matrix long-form where each row represents a cell in the...

View source: R/utils.R

make_long_formR Documentation

Make matrix long-form where each row represents a cell in the matrix

Description

Each row represents a cell in the matrix (rowname, column name, value). If the matrix is symmetric, there will be one row for each symmetric pair (i.e. the number of rows in the long-form data frame will be half the number of elements in the input matrix). If the matrix is asymmetric, all rows will be kept (i.e. the number of rows in the long-form data frame will be equal to the number of elements in the input matrix).

Usage

make_long_form(facil_dist, col_names = c("loc1", "loc2", "fsp"))

Arguments

facil_dist

symmetric or asymmetric matrix that you want to convert to long form.

col_names

Column names for the output data frame (3 columns - rownames, colnames, values)

Value

long form data where each row represents a cell in the matrix (rowname, column name, value)

Examples

make_long_form(fsp)

Snitkin-Lab-Umich/regentrans documentation built on Jan. 29, 2023, 7:45 a.m.