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

Sarah Goslee sarah.goslee at gmail.com
Mon Mar 28 16:34:55 CEST 2016


It isn't at all clear to me how you are creating the groups. They
aren't the unique combinations of Component and TLA. They might be
based only on TLA value: in your example TLA1 and TLA2 form one group,
and TLA3 the other.

Without understanding your logic, I can't replicate it with R code.

Sarah

On Sun, Mar 27, 2016 at 8:56 PM, Satish Vadlamani
<satish.vadlamani at gmail.com> wrote:
> 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]]
>
And please don't post in HTML.



More information about the R-help mailing list