Learn R Programming

ddgraph (version 1.16.0)

convertToFactor: Convert data to factor representation

Description

Convert a matrix, dataframe or vector into a factor representation. Each column is going to be separately converted into a factor.

Usage

convertToFactor(x)

Arguments

x
the input vector, data.frame or matrix

Examples

Run this code
convertToFactor(0)
convertToFactor(c(1, 0, 0, 1, 0))
convertToFactor(matrix(c(1,0), nrow=2, ncol=2))
convertToFactor(data.frame("a"=c(1,0), "b"=c(0,1)))

Run the code above in your browser using DataLab