Change a matrix from character data to numeric data without changing the row and column names?

Well, te sample data you provided contains characters not integers so I assumed it was representative of your actual data.

To help you with specific coding problems we need you to provide a proper REPRoducible EXample (reprex) illustrating your issue.