numericPart: Splits a mixed data frame into a numeric matrix and a factor...

numericPartR Documentation

Splits a mixed data frame into a numeric matrix and a factor part.

Description

The function numericPart() converts a data.frame to a matrix, by dropping columns which contain non-numeric data. The function factorPart grabs the state information by selecting only columns which are factors.

Usage

numericPart(table)
factorPart(table)

Arguments

table

A data.frame object.

Details

The primary purpose is to split a conditional probability distribution in data frame format (with a set of factor rows identifying the states of the parent variables) to a table of just the numbers, and a data frame of just the factors so that they can be tackled separately.

Value

A matrix containing just the numeric (or factor) columns of the data frame.

Author(s)

Russell Almond

See Also

data.frame, matrix, data.matrix

Examples

name <-c("Shahrazad", "Marguerite")
height <- c(34, 36)
weight <- c(28, 26)
twins <- data.frame(name=as.factor(name),height=height, weight=weight)
numericPart(twins)
factorPart(twins)

ralmond/CPTtools documentation built on Dec. 27, 2024, 7:15 a.m.