[2,] 2 5 8
[3,] 3 6 9
二、矩阵取子集
m[2,] [1] 2 5 8
m[,1] [1] 1 2 3
矩阵取子集不支持
三、加列名...[,2] [,3]
a 1 2 3
b 4 5 6
c 7 8 9
as.data.frame(m)
#转换为数据框,没有赋值,所以输出结果仍是矩阵,只是在控制台看看结果...::pheatmap(m)
pheatmap::pheatmap(m,cluster_cols = F,cluster_rows =F )
六、新建列表和取子集
l 可以
### 补充:元素的名字
scores = c(100,59,73,95,45)
names(scores) = c("jimmy","nicker","Damon","Sophie...a <- as.matrix(iris[1:5,1:4])
a
#3.将a的行名改为flower1,flower2...flower5。