考虑my.list
:
my.list <- list(member.one = rnorm(3),
member.two = data.frame(a = rnorm(2),
b = rnorm(2) + 1))
my.list
# $member.one
# [1] -0.4803475 -0.7755822 0.9740834
#
# $member.two
# a b
# 1 -0.7026612 1.1467156
# 2 0.3708469 0.6776552
有没有办法获得my.list$member.one
,member.one
的名称?
magic.function(my.list$member.two)
# [1] "member.two"
names()
对我不起作用:
names(my.list$member.two)
[1] "a" "b"