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.
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)