我有以下数据框:
dat <- structure(list(BAR = structure(list(V3 = structure(c(1L, 1L), .Label = "Unigene126925_All", class = "factor"),
V4 = structure(c(3L, 1L), .Label = c("Unigene111784_All",
"Unigene137063_All", "Unigene165366_All", "Unigene24551_All",
"Unigene31835_All"), class = "factor"), V5 = c(0.247844,
0.344493)), .Names = c("V3", "V4", "V5"), row.names = 4:5, class = "data.frame"),
FOO = structure(list(V3 = structure(c(1L, 1L, 1L), .Label = "Unigene126925_All", class = "factor"),
V4 = structure(c(2L, 4L, 5L), .Label = c("Unigene111784_All",
"Unigene137063_All", "Unigene165366_All", "Unigene24551_All",
"Unigene31835_All"), class = "factor"), V5 = c(0.238087,
0.374231, 0.367897)), .Names = c("V3", "V4", "V5"), row.names = c(NA,
3L), class = "data.frame")), .Names = c("BAR", "FOO"))
其中显示了这一点:
> dat
$BAR
V3 V4 V5
4 Unigene126925_All Unigene165366_All 0.247844
5 Unigene126925_All Unigene111784_All 0.344493
$FOO
V3 V4 V5
1 Unigene126925_All Unigene137063_All 0.238087
2 Unigene126925_All Unigene24551_All 0.374231
3 Unigene126925_All Unigene31835_All 0.367897
我想获得返回c("FOO","BAR")
的数据框列表的密钥。
它的方法是什么?
答案 0 :(得分:1)
使用?names
:
> names(dat)
[1] "BAR" "FOO"