Hello, thanks for the quick answers! Some answers were more useful to me than others but I really appreciate everybodys effort, reading and answering my question.
I will try Dons approach because as he said, it looks quite readable. I'll need to take a closer look on the nested ifelse statements to understand and use them. What I learned from asking this question is, that I should have stated my problem far more precisely. I should have shown you what I tried and what error messages appeared. Thanks everybody, Richard ______________________________________________ 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.