I just studied the foreach function in the R, and saw the codes:
x <- foreach(i=1:3 ) %do% exp(i)
I am just curious how can we use "%do%" in the function foreach. What is the "%do%" for the function foreach? Is it a kind of special parameter?
I've seen the source code of foreach, but cannot find any clue.
So anyone can help me to figure what is it, and how to use it in our defined functions.
Note to moderators: The function %do%
has a specific purpose that is not entirely explained by the fact that the flanking percent signs make it an infix operators. Please reopen.