Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

data.frame.to_matrix

Convert a dataframe to matrix


Description

Convert a dataframe to matrix.

Usage

data.frame.to_matrix(x,col.names = NULL,row.names = NULL)

Arguments

x

A Numeric matrix with data and NAs.

col.names

A boolean value for keeping the colnames for argument x or a character vector for the new colnames.

row.names

A boolean value for keeping the rownames for argument x or a character vector for the new rownames.

Details

This functions converts a dataframe to matrix. Even if there are factors, the function converts them into numerical values. Attributes are not allowed for now.

Value

A matrix wich has the numrical values from the dataframe.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>

See Also

Examples

res<-data.frame.to_matrix(iris)

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.