On 12-12-07 7:27 AM, Dimitri Liakhovitski wrote:
Dear R-ers,
my task is to simple: to assign cases to desired groupings based on the
combined values on 2 variables. I can think of 3 methods of doing it.
Method 1 seems to me pretty r-like, but it requires a lot of lines of code
- onerous.
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
Wow, Arun I think I really like this solution. It allows me to create
irregular groupings and is very parsimonious.
Thank you very much!
Dimitri
On Fri, Dec 7, 2012 at 8:09 AM, arun smartpink...@yahoo.com wrote:
HI,
In your method2 and method3, you are using the groupings data. If that is
HI,
In your method2 and method3, you are using the groupings data. If that is the
case, is it possible for you to use ?merge() or ?join() from library(plyr)
join(mydata,groupings,by=c(sex,age),type=inner)
# sex age mygroup
#1 m 1 1
#2 m 2 2
#3 m 3 3
#4 m
4 matches
Mail list logo