Seems a rudimentary question. Is there a way to print() or message() between iterations of a function so that the print is between the list elements in the console output. Example:
two_sq <- function (x) {
print(paste("this is ", x))
x^2
}
lapply(1:3, two_sq)
Gives:
# [1] "this is 1"
# [1] "this is 2"
# [1] "this is 3"
# [[1]]
# [1] 1
# [[2]]
# [1] 4
# [[3]]
# [1] 9
Desired output:
# [1] "this is 1"
# # [[1]]
# # [1] 1
# [2] "this is 2"
# # [[2]]
# # [1] 4
# [3] "this is 3"
# # [[3]]
# # [1] 9