R语言报错,没有重复的某一列成为行名,总是报错
row.names(mm3) <- mm3[,2]
Error in `.rowNamesDF<-`(x, value = value) :
missing values in 'row.names' are not allowed
解决方案-把数据框转变成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]