我想要一个命名列表,但我想以懒惰的评估方式获取这些名称。这可能吗?如果没有,你能有多接近?
> a <- 1:3
> b <- 4:6
> foo_anon <- list(a, b)
> foo_anon
[[1]]
[1] 1 2 3
[[2]]
[1] 4 5 6
> names(foo_anon) # I am sad
NULL
> foo_named <- list(a = a, b = b)
> foo_named
$a
[1] 1 2 3
$b
[1] 4 5 6
> names(foo_named) # I am sad because I do not scale
[1] "a" "b"