我在R
中有以下列表> str(Grades.Good)
List of 2
$ FALSE: Named num [1:10] 89 74 64 61 55 80 78 73 57 87
..- attr(*, "names")= chr [1:10] "Bettie" "Dona" "Frances" "Gerri" ...
$ TRUE : Named num [1:5] 94 97 94 91 92
..- attr(*, "names")= chr [1:5] "Alana" "Consuela" "Elaine" "Kenyatta" ...
我正在尝试从第二项Grades.Good [2]中提取名称。我试过了:
> names(Grades.Good[2])
[1] "TRUE"
> names(Grades.Good)[2]
[1] "TRUE"
> names(Grades.Good$TRUE)
Error: unexpected numeric constant in "names(Grades.Good$TRUE"
使用名称" Alana"提取字符向量的最佳方法是什么? " Consuela" "伊莱恩" "肯雅塔" ...?