I made a function my_fun() which generates messages with the message() function. And also uses pb$tick() to track progress with progress::progress_bar.
I am running this function inside a purrr::map() call to iterate over a long list like: map(my_list, my_fun). So the message is displayed a over and over.
I would like to suppress the message like
map(my_list, suppressMessages(my_fun))
but it has no effect.
The call suppressMessages(map(my_list, my_fun)) works but that suppresses the progress_bar as well.
Is there a convenient way to remove the messages without removing the message() calls from my_fun()?
Though you have not included any reproducible example for your use case, yet in my opinion, the following code using anonymous function style of
purrrshould work.Do not forget to use twiddle
~in above.