lapply() with user input

r

Solution

Here is the example:

es <- list(1, 2, 3)
lapply(es, function(e) {
  cat("Press enter:")
  readLines(n = 1)
  print(e)
})

Problem

Is there a way to use `lapply()` in a manner that forces it to wait for "enter" from the user before stepping through the next element of the list? If so, could you provide a simple example?

Original source