sparse_cast: Create a sparse matrix from row names, column names, and...

Description Usage Arguments Value Examples

Description

Create a sparse matrix from row names, column names, and values in a table.

Usage

1
sparse_cast(data, row, column, value)

Arguments

data

A tbl

row

A bare column name to use as row names in sparse matrix

column

A bare column name to use as column names in sparse matrix

value

A bare column name to use as sparse matrix values, default 1

Value

A sparse Matrix object, with one row for each unique value in the row column, one column for each unique value in the column column, and with as many non-zero values as there are rows in data.

Examples

1
2
3
4
5
6
7
dat <- data.frame(a = c("row1", "row1", "row2", "row2", "row2"),
  b = c("col1", "col2", "col1", "col3", "col4"),
  val = 2)

sparse_cast(dat, a, b)

sparse_cast(dat, a, b, val)

dgrtwo/GSEAMA documentation built on May 15, 2019, 7:22 a.m.