To pass a dataframe in R to matrix

as.matrix(mtcars)

Some commands work over matrix and not over dataframes