Is there an R equivalent to Mathematica's Sow and Reap functions for building lists?
问题 Mathematica has an interesting way of incrementally building a list (or more than one list) of results that you calculate at various points of a complicated computation. I'd like to do something similar in R. In Mathematica, you can collect the list of each argument to each invocation of the Sow function during a computation by wrapping the entire calculation in call to the Reap function. Does R have any equivalent to these functions? Could you perhaps emulate it with environments and the <<-