matrix2dataframe: matrix2dataframe

Description Usage Arguments Value Examples

View source: R/matrix2dataframe.R

Description

Converts a numeric matrix to a data frame with decreasing or increasing values: First column row index, second column col index and third column the value. If the matrix is symmetric, only the upper triangle is taken into account.

Usage

1
2
3
4
5
6
7
matrix2dataframe(
  m,
  decreasing = TRUE,
  tol = 100 * .Machine$double.eps,
  tol1 = 8 * tol,
  ...
)

Arguments

m

numeric: a matrix of values

decreasing

logical: should the sort order be increasing or decreasing (default: TRUE)

tol

numeric scalar >= 0. Smaller differences are not considered, see all.equal.numeric.

tol1

numeric scalar >= 0. isSymmetric.matrix() ‘pre-tests’ the first and last few rows for fast detection of ‘obviously’ asymmetric cases with this tolerance. Setting it to length zero will skip the pre-tests.

...

further arguments passed to methods; the matrix method passes these to all.equal. If the row and column names of object are allowed to differ for the symmetry check do use check.attributes = FALSE!

Value

a data frame with an attribute matrix with m

Examples

1
2
3
# non-symmetric
x <- matrix(runif(9), ncol=3)
matrix2dataframe(x)

rscc documentation built on Jan. 20, 2022, 5:08 p.m.