Matrices may be converted to data frames by using the data.frame
command (there's no as.frame
). Data frames may be
converted to matrices with as.matrix
, although keep in
mind that matrices, like vectors, can only contain one type of
data while data frames can contain several. If there are any
characters in the data frame, converting it to a matrix will
result in all of the elements being converted to characters.