[R] Following progress in a lapply() function

Blanchette, Marco MAB at stowers.org
Sun Mar 22 23:06:52 CET 2009

Dear all,

I am processing a very long and complicated list using lapply through a custom function and I would like to generate some sort of progress report. For instance, print a dot on the screen every time 1000 item have been process. Or even better, reporting the percent of the list that have been process every 10%. However, I can't seem to figure out a way to achieve that.

For instance, I have a list of 50,000 slots:

aList <- replicate(50000,list(rnorm(50)))

That need to be process through the following custom function:

myFnc <- function(x){
     tTest <- t.test(x)

Using an lapply statement, as in:

myResults <- lapply(aList, myFnc)

The goal would be to report on the progress of the lapply() function during processing.

Any suggestion would be greatly appreciated.



Marco Blanchette, Ph.D.
Assistant Investigator
Stowers Institute for Medical Research
1000 East 50th St.

Kansas City, MO 64110

Tel: 816-926-4071
Cell: 816-726-8419
Fax: 816-926-2018

More information about the R-help mailing list