Learn R Programming

broom (version 0.5.6)

matrix_tidiers: Tidiers for matrix objects

Description

Matrix tidiers are deprecated and will be removed from an upcoming release of broom.

Usage

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

# S3 method for matrix glance(x, ...)

Arguments

x

A matrix

...

extra arguments, not used

Value

tidy.matrix returns the original matrix converted into a data.frame, except that it incorporates rownames (if they exist) into a column called .rownames.

glance returns a one-row data.frame with

nrow

number of rows

ncol

number of columns

complete.obs

number of rows that have no missing values

na.fraction

fraction of values across all rows and columns that are missing

Details

These perform tidying operations on matrix objects. tidy turns the matrix into a data.frame while bringing rownames, if they exist, in as a column called .rownames (since results of tidying operations never contain rownames). glance simply reports the number of rows and columns. Note that no augment method exists for matrices.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
mat <- as.matrix(mtcars)
tidy(mat)
glance(mat)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab