My example data indeed looks regular, but in reality neither the data nor
the assignments are regular.
E.g., sometimes all females would land in one grouping and males of
different ages will land in different groupings.
So, I am afraid the "with" solution won't work.
Dimitri

On Fri, Dec 7, 2012 at 7:54 AM, Duncan Murdoch <murdoch.duncan@gmail.com>wrote:

> mydata$mygroup.m4 <- with(mydata,
>                              4*(2-as.integer(factor(sex)))
>                              + as.integer(factor(age)))
>
>


-- 
Dimitri Liakhovitski
gfk.com <http://marketfusionanalytics.com/>

	[[alternative HTML version deleted]]


