Thank you so much Jim, Duncan, and special thanks to Rui!! The modified script from Rui works perfectly and I really learned a lot from all your suggestions. Regards, Amber -- View this message in context: http://r.789695.n4.nabble.com/break-function-in-loop-tp4435033p4435399.html Sent from the R help mailing list archive at Nabble.com.