문제

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?

도움이 되었습니까?

해결책

Use ?names:

> names(dat)
[1] "BAR" "FOO"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top