I would like to perform heatmap. I transferred the data frame to matrix. My first column in the matrix contains 51 state names in character format. Due to this when I execute heatmap an error pops out ('X' must be numeric). If I convert the matrix into numeric all the states get converted to numeric values from 1 to 51. Name of the state gets changed to numbers. I would like someone to help me in converting the character column into numeric without any value change in the column.
 [enter image description here](https://i.stack.imgur.com/iZG9z.png)
I get the following error:

```
> heatmap.2(matrix)
Error in heatmap.2(matrix) : `x' must be a numeric matrix

dput(matrix[1:20,1:5])
structure(c("AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", 
"FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", 
" 156023.01", " 934292.20", " 565543.16", " 859246.77", "1802826.03", 
" 236048.04", " 277419.16", "  44170.06", " 364245.19", "3059883.80", 
"1032052.28", "  49148.00", " 484355.76", " 103032.97", "1501399.16", 
"1098716.37", " 536964.81", " 714912.96", " 930454.92", "1006184.61", 
NA, " 647281.97", " 243467.03", " 222016.05", "1955376.54", " 284157.80", 
" 546510.14", " 310209.01", " 238855.76", "3055374.94", " 620487.04", 
"  52286.08", " 183689.95", " 101198.95", "2299302.42", " 682522.43", 
" 203429.06", " 566182.29", " 434137.97", "1269701.60", "  279984.88", 
" 1785117.72", " 1210217.08", " 1738388.11", "12313826.52", " 1033786.31", 
" 1905870.34", " 1589936.20", " 1177198.27", " 7379680.11", " 3182089.09", 
"  539865.15", "  907408.47", "  706547.91", " 5616722.28", " 2793763.32", 
"  751262.24", " 2620593.80", " 3327343.31", " 3423941.61", "  277346.4", 
" 3231424.9", " 1784411.7", " 2539940.3", "13107647.6", " 1623508.4", 
" 2475804.7", " 1382151.2", " 1362240.3", "10431341.9", " 4514651.7", 
" 1081821.1", " 1653629.7", "  594605.5", " 9147134.3", " 4121661.9", 
" 1292330.2", " 3252592.8", " 3360762.2", " 4269284.1"), .Dim = c(20L, 
5L), .Dimnames = list(NULL, c("Provider.State", "039 ", "057 ", 
"064 ", "065 ")))

```