以下工作正常:
pmap_dbl(iris, ~ ..1 + ..2 + ..3 + ..4)
Run Code Online (Sandbox Code Playgroud)
.l提供的文档A list of lists. ... List names will be used if present..这表明您应该能够使用列表名称(即列名称).然而:
pmap_dbl(iris, ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width)
Error in .f(Sepal.Length = .l[[c(1L, i)]], Sepal.Width = .l[[c(2L, i)]], :
object 'Sepal.Length' not found
Run Code Online (Sandbox Code Playgroud)
如何在实践中利用列表名称?