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 <[email protected]>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]] ______________________________________________ [email protected] 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.

