将矩阵元素从字符转换为数字

时间:2015-11-05 13:52:52

标签: r matrix

如何更改以下矩阵中的数字类别,将“果实”更改为字符

中的数字
> fruits
        June     July     August    September October  November December
Apple   "809936" "901956" "1311202" "1121499" "711812" "79647"  "0"     
Mango   "663300" "667529" "669158"  "664627"  "657280" "78982"  "0"     
Banana  "484458" "436396" "475879"  "496827"  "507660" "54120"  "0"  

1 个答案:

答案 0 :(得分:1)

如果m是您的矩阵,您可以尝试:

`class<-`(m, 'numeric')