R語言報(bào)錯(cuò),沒有重復(fù)的某一列成為行名,總是報(bào)錯(cuò)
row.names(mm3) <- mm3[,2]
Error in `.rowNamesDF<-`(x, value = value) :
missing values in 'row.names' are not allowed

image.png
解決方案-把數(shù)據(jù)框轉(zhuǎn)變成matrix
mm3 <- as.matrix(mm3)
row.names(mm3) <- mm3[,2]