我有这个:
> str(pa1)
num [1:83, 1:9] -1.46 -2.28 -3.69 -4.98 -5 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:83] "1" "2" "3" "4" ...
..$ : chr [1:9] "PC1" "PC2" "PC3" "PC4" ...
如何访问上面显示的pa1
的最后一部分,即
"PC1" "PC2" "PC3" "PC4" ...
答案 0 :(得分:2)
dimnames
有一个特定的功能,通常你会得到attr
函数的属性(正如str
的输出所示)。
dimnames(pa1)[[2]]
#or
attr(pa1,"dimnames")[[2]]