added R-foreach