r matrix convert factor to numeric code example Example: data frame to matrix r data.matrix(frame, rownames.force = NA)