[R] How to form groups for this specific problem?

Satish Vadlamani satish.vadlamani at gmail.com
Mon Mar 28 02:56:07 CEST 2016

Hello All:
I would like to get some help with the following problem and understand how
this can be done in R efficiently. The header is given in the data frame.

*Component, TLA*
C1, TLA1
C2, TLA1
C1, TLA2
C3, TLA2
C4, TLA3
C5, TLA3

Notice that C1 is a component of TLA1 and TLA2.

I would like to form groups of mutually exclusive subsets and create a new
column called group for this subset. For the above data, the subsets and
the new group column value will be like so:

*Component, TLA, Group*
C1, TLA1, 1
C2, TLA1, 1
C1, TLA2, 1
C3, TLA2, 1
C4, TLA3, 2
C5, TLA3, 2

Appreciate any help on this. I could have looped through the observations
and tried some logic but I did not try that yet.


Satish Vadlamani

	[[alternative HTML version deleted]]

More information about the R-help mailing list