Dear Bert-- I tried your function on the data that I provided (data.df) and it worked beautifully (after I added a missing final parenthesis), producing exactly the same output as my function. This is an excellent example of what I was looking for, because it is (a) 50% shorter than mine, (b) fully vectorized, and (c) uses three functions that I have never used before: with, unique, and do.call
I am going to spend a happy afternoon working through this command by command and at the end I am confident that I will have learned some valuable new ( to me) tricks. Thanks! Warmest Regards, AndrewH -- View this message in context: http://r.789695.n4.nabble.com/replacing-ugly-for-loops-tp4645821p4645914.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.