Matching these matrices in R
Since they share the ensembl_ID column, you can merge them, then assign the symbol column to the rownames, then delete the symbol column.

something like:

merged &lt;- merge(mat1, mat2, by = 0) 
rownames(merge) &lt;- merged[,'symbol'] 
merged[,symbol] &lt;- NULL


https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html