Convert a Data Frame into a Numeric Matrix

DESCRIPTION:
This function takes a data frame as an argument and returns a matrix of numeric data whose elements correspond to the elements of the data frame.

USAGE:
data.matrix(frame)

REQUIRED ARGUMENTS:
frame:
a data frame, or else a frame that inherits from class "data.frame" (design or model frame).

VALUE:
a numeric matrix containing the numeric information in frame. The matrix has a column for each numeric vector, a set of columns for each matrix, and a column for each factor in frame. Factors are first transformed to numeric values using codes(). If factors are present in frame, the matrix returned has an attribute called "column.levels", a list with an element for each column of the matrix. The elements of this list are either NULL or else contain the levels of the factors prior to conversion by codes().

SEE ALSO:
as.matrix , codes , model.matrix .

EXAMPLES:
cu.summary[1:5,]

# returns the following: Price Country Reliability Mileage Type Acura Integra 4 11950 Japan Much better NA Small Dodge Colt 4 6851 Japan NA NA Small Dodge Omni 4 6995 USA Much worse NA Small Eagle Summit 4 8895 USA better 33 Small Ford Escort 4 7402 USA worse 33 Small

data.matrix(cu.summary[1:5,])

# returns the following: Price Country Reliability Mileage Type Acura Integra 4 11950 5 5 NA 4 Dodge Colt 4 6851 5 NA NA 4 Dodge Omni 4 6995 10 1 NA 4 Eagle Summit 4 8895 10 4 33 4 Ford Escort 4 7402 10 2 33 4