Learn R Programming

broom (version 1.0.0)

sparse_tidiers: Tidy a sparseMatrix object from the Matrix package

Description

Tidy a sparseMatrix object from the Matrix package into a three-column data frame, row, column, and value (with zeros missing). If there are row names or column names, use those, otherwise use indices

Usage

# S3 method for dgTMatrix
tidy(x, ...)

# S3 method for dgCMatrix tidy(x, ...)

# S3 method for sparseMatrix tidy(x, ...)

Value

A tibble::tibble() with columns:

row

Row ID of the original observation.

value

The value/estimate of the component. Results from data reshaping.

column

Column name in the original matrix.

Arguments

x

A Matrix object

...

Additional arguments. Not used. Needed to match generic signature only. Cautionary note: Misspelled arguments will be absorbed in ..., where they will be ignored. If the misspelled argument has a default value, the default value will be used. For example, if you pass conf.lvel = 0.9, all computation will proceed using conf.level = 0.95. Two exceptions here are:

  • tidy() methods will warn when supplied an exponentiate argument if it will be ignored.

  • augment() methods will warn when supplied a newdata argument if it will be ignored.