我正在尝试使用相关矩阵,为此,第一列中的值(Faculty)应转换为行名。
这是数据的外观:
Row Faculty Answer Q1
1 Architecture, Building and Planning 5
2 Social studies 20
3 Law 2
4 Business and Administrative studies. 45
5 Languages 53
6 Historical and Philosophical studies. 16
7 Creative Arts and Design 9
这就是我想要的:
Row Answer Q1
Architecture, Building and Planning 5
Social studies 20
Law 2
Business and Administrative studies. 45
Languages 53
Historical and Philosophical studies. 16
Creative Arts and Design 9
我尝试了rownames(mydata) <- mydata[, 1]
给了我错误:
`(`*tmp*`, value = list(Subject = c("(1) Architecture, Building and Planning", :
length of 'dimnames' [1] not equal to array extent
任何人都知道如何解决这个问题?