【发布时间】:2015-11-05 13:52:51
【问题描述】:
如何将下面矩阵中的数字类别“水果”从字符更改为数字
> 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"
【问题讨论】:
-
随便
'dim<-'(as.numeric(fruits), dim(fruits)) -
@akrun 我的数字变成了数字但我失去了我的标题
-
使用如下类。无论如何,我很快就会取消我的回答。
-
试试这个:
class(fruits) <- "numeric" -
@gitblame 的回答效果很好