BASSLINE_convert: Convert dataframe with mixed variables to a numeric matrix

View source: R/Utils.R

BASSLINE_convertR Documentation

Convert dataframe with mixed variables to a numeric matrix

Description

BASSLINE's functions require a numeric matrix be provided. This function converts a dataframe of mixed variable types (numeric and factors) to a matrix. A factor with $m$ levels is converted to $m$ columns with binary values used to denote which level the observation belongs to.

Usage

BASSLINE_convert(df)

Arguments

df

A dataframe intended for conversion

Value

A numeric matrix suitable for BASSLINE functions

Examples

library(BASSLINE)
Time <- c(5,15,15)
Cens <- c(1,0,1)
experiment <- as.factor(c("chem1", "chem2", "chem3"))
age <- c(15,35,20)
df <- data.frame(Time, Cens, experiment, age)
converted <- BASSLINE_convert(df)


nathansam/SMLN documentation built on May 14, 2022, 9:07 p.m.