to.matrix: 'S3' generic; convert to matrix *move* column to 'rownames'

View source: R/to.matrix.R

to.matrixR Documentation

S3 generic; convert to matrix move column to rownames

Description

Useful when working with data.tables; cannot have rownames. Other methods (as.matrix, data.table::setDF) allow to convert to a data.frame but then another step is necessary to move an identifier column to rownames. This function allows the two in one step.

Usage

to.matrix(x, ...)

## S3 method for class 'data.table'
to.matrix(x, id.col = NULL, drop.id.col = TRUE)

Arguments

x

type: data.table A data.table object with an identifier column.

...

Value

matrix

Author(s)

Dereck de Mezquita


CoarfaBCM/derecksLabTools documentation built on April 3, 2022, 10:29 p.m.