0

我有这个:

> 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" ...

?

4

1 回答 1

2

有一个特定的函数dimnames,通常你会得到attr函数的属性(如输出str所示)。

dimnames(pa1)[[2]]
#or
attr(pa1,"dimnames")[[2]]
于 2013-02-23T18:04:09.330 回答