I have the following data frame:
我有以下数据框:
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"))
Which shows this:
这显示了这个:
> 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
I would like to get the key of that list of data frames returning c("FOO","BAR")
. What's the way to go about it?
我想获得返回c(“FOO”,“BAR”)的数据帧列表的键。怎么办呢?
1 个解决方案
#1
1
Use ?names
:
使用?名称:
> names(dat)
[1] "BAR" "FOO"
#1
1
Use ?names
:
使用?名称:
> names(dat)
[1] "BAR" "FOO"