R語言報錯懈万,沒有重復(fù)的某一列成為行名,總是報錯
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]
row.names(mm3) <- mm3[,2]
Error in `.rowNamesDF<-`(x, value = value) :
missing values in 'row.names' are not allowed
mm3 <- as.matrix(mm3)
row.names(mm3) <- mm3[,2]