What is the purrr::map equivalent of:
for (i in 1:4) {
for (j in 1:6) {
print(paste(i, j, sep = "-"))
}
}
OR
lapply(1:4, function(i)
lapply(1:6, function(j)
print(paste(i, j, sep = "-"))))
Conceptually, what I'm not getting is how to refer to the outer loop in the inner map function.
map(1:4, ~ map(1:6, ~ print(paste(.x, ????, sep = "-")))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…