Thank you for your response.
Below is some code that shows the disruption to a progress bar. I am running this in RStudio on a MacBook. The behaviour is similar in R run from the Terminal (although the progress bar does not flash, but is simply not shown).
I am not sure how best to post the console output, but the only output from the code below is the finished progress bar for the second loop and nothing for the first. The key issue as far as I can see is the additional line being output by readxl and overwriting the progress bar every cycle - any code that does not output this line plays nicely with the progress bars. The output of the code from my first post is merely a blank line and not really postable!
# Reading in the Excel file causes the progress bar to flash (it is being overwritten by the rogue console output from readxl)
pbapply::pboptions(txt.width = 50, style = 3)
pb = pbapply::startpb(min = 0, max = 20)
output = lapply(1:20, function(i){
pbapply::setpb(pb, i)
result = readxl::read_excel(readxl::readxl_example("clippy.xls"))
Sys.sleep(0.1)
})
# With the read_excel line commented out, the progress bar flows as expected.
pbapply::pboptions(txt.width = 50, style = 3)
pb = pbapply::startpb(min = 0, max = 20)
output = lapply(1:20, function(i){
pbapply::setpb(pb, i)
# result = readxl::read_excel(readxl::readxl_example("clippy.xls"))
Sys.sleep(0.1)
})