Possible duplicate on SO: Computing a new variable using conditions of an existing data frame
I am trying to create a vector (e.g. z) from the group means. The vector will have a length equal to the number of rows of the original data frame from where the group mean was created and each element of the vector z will correspond to the group member.
For example,
A mean of group A
C mean of group c
F mean of group F
C mean of group C
etc.
Any help will be appreciated.