我有一个名为dat的数据框 . 我在名为maxIndex.numeric的数字向量中有行索引 . 我想从dat中检索与maxIndex.numeric向量中的值对应的所有行名 . 我尝试了以下操作,但错误如下所示:
rownames(subset(dat,x == maxIndex.numeric))
character(0)警告消息:在x == maxIndex.numeric中:较长的对象长度不是较短对象长度的倍数
谢谢
这应该这样做:
rownames(dat)[maxIndex.numeric]
1 回答
这应该这样做: