R语言为数据框添加列名或行名
1.添加列名
wts=c(1,1,1)
names(wts)=c("setosa","versicolor","virginica")
2.为矩阵添加列名和行名
wts=matrix(0,3,4)
row=c("row1","row2","row3")
column=c("setosa","versicolor","virginica")
dimnames(wts)=list(row,column)
文章来自:http://www.cnblogs.com/longzhongren/p/4305206.html