Deciding which samples go in which batch
I found the OSAT package which does almost what I want. 


However it is specific for Illumina and for a limited number of plates: "plates that hold 2, 4, 8 IlluminaBeadChip chips and have 24, 48, 96 wells, respectively."
It doesn't take in consideration the numeric values:

library(OSAT)
inPath &lt;- system.file('extdata', package='OSAT')
pheno &lt;- read.table(file.path(inPath, 'samples.txt'), 
                    header=TRUE, sep="\t", colClasses="factor")
pheno$AgeGrp &lt;- runif(576, 0, 100)
gs &lt;- setup.sample(pheno, optimal=c("SampleType", "Race", "AgeGrp"))
gc &lt;- setup.container(IlluminaBeadChip96Plate, 6, batch='plates')
gSetup &lt;- create.optimized.setup(sample=gs, container=gc, nSim=1000)





The minDiff package reported in Stats.SE.


It handles both numeric and categorical data, but it can only optimize for two nominal criteria.


I wrote experDesign which does everything I wanted


It can handle both numeric and categorical data for an arbitrary number of variables. It is not restricted to an even number of samples per batch.