castToMatrix: Cast a data.table to a matrix

Description Usage Arguments Value See Also

View source: R/castToMatrix.R

Description

A wrap-around the dcast function that returns a matrix instead of a data.table

Usage

1
castToMatrix(data, formula, value.var, fun.aggregate, fill = NA, ...)

Arguments

data

A data.table.

formula

A formula of the form LHS ~ RHS to cast, see Details.

value.var

Name of the column whose values will be filled to cast. Function guess() tries to, well, guess this column automatically, if none is provided.

Cast multiple value.var columns simultaneously by passing their names as a character vector. See Examples.

fun.aggregate

Should the data be aggregated before casting? If the formula doesn't identify a single observation for each cell, then aggregation defaults to length with a message.

To use multiple aggregation functions, pass a list; see Examples.

fill

Value with which to fill missing cells. If fun.aggregate is present, takes the value by applying the function on a 0-length vector.

...

Any other arguments that may be passed to the aggregating function.

Value

A matrix with columns and rows corresponding to the formula.

See Also

dcast


oliviermfmartin/HelpingHand documentation built on Oct. 10, 2020, 5:59 a.m.