dMcast: dMcast

View source: R/dMcast.R

dMcastR Documentation

dMcast

Description

Reimplementation of function that originally part of the R package Matrix.utils before the package was deprecated. The only difference is that this version of dMcast does not include an aggregation feature at the end.

Usage

dMcast(
  data,
  formula,
  value.var = NULL,
  as.factors = FALSE,
  na.action = stats::na.pass,
  factor.nas = TRUE,
  drop.unused.levels = TRUE
)

Arguments

data

A data.frame.

formula

Casting formula, see details for specifics.

value.var

Name of column that stores values to be aggregated numerics.

as.factors

If TRUE, treat all columns as factors, including

factor.nas

If TRUE, treat factors with NAs as new levels. Otherwise, rows with NAs will receive zeroes in all columns for that factor.

drop.unused.levels

Should factors have unused levels dropped? Defaults to TRUE, in contrast to model.matrix

Value

matrix

Source

groupings <- data.frame(A = as.factor(sample(1e4,1e6,TRUE))) formula <- stats::as.formula("~0+.") dm <- orthogene:::dMcast(data = groupings, formula = formula)


neurogenomics/orthogene documentation built on Jan. 30, 2024, 4:44 a.m.