Assign subjects into groups so that group means are as similar as possible I have some subjects from I have measured a variable (body weight). I want to do a case-control experiment where I will do an intervention on one of the groups (Experimental). I'd like for the group means to be as close as possible to begin. My questions are:


*

*Is this a legitimate way to assign subjects?

*Is there a statistical programming way (R) to do this?


I think this article describes what I'm trying to do, so it sounds like this is accepted practice, but I'm not sure. And it's in SAS, so not helpful to me (I'm using R).
 A: Before revealing one option for pairing participants based on certain features, you should strongly consider @whuber's suggestion to use a totally random design. There are numerous benefits, both statistical and practical that are afforded by random assignment. For one, a random sample is easy to explain, and most people intuitively understand its value in experimental design. With random sampling any variation between the groups should be non-systematic in nature, and most statistical tests you would want to run are well-suited for these sorts of designs. In taking a random approach, you also avoid putting your finger on the scale by accident and ensure that your results are easily compared to future investigations of the same population using random designs. Any matching algorithm you use will necessarily be unique in some ways to your obtained sample, and may not be replicable in future cohorts. 
That all being said, there is a package called optmatch in R. An accessible review of its features can be found here. This is but one option out there, and before you use a tool like this, I strongly recommend testing it out on some simulated data so that you can fully assess the potential consequences of specific choices available to you.
Again, I would say that whenever possible, random assignment is the ideal choice, but there are some tools out there (like optmatch) that can help in specific situations.  
