Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Thanks! This is a nice solution, however, I have 16 countries and at least 3 conditions, so I would have to add at least 48 lines of code to incorporate your solution. I'm transitioning from SAS to R and in SAS this could be done very elegantly with a macro variable loop. Commented May 16, 2012 at 2:54
  • Oh, this can be done very easily with a loop. I'm adding an explanation to my answer. Commented May 16, 2012 at 2:57