I have some multilevel data with a group variable (groups 1-100). Some of my other variables are within-group means, hence they have the same value repeated for every individual within group i. I'd like to reshape the data so that each group has only one line (instead of one for every individual within the group) so I can better use the within-group mean variables. For now, I don't care what happens with the individual-level variables.
I'm guessing the reshape package must be the way to go, but I haven't had any success fiddling around with it.
Edit: Here's an example of what my data look like:
groupmean = c(1.4, 1.4, 1.4, 1.4, 6.2, 6.2, 6.2, 6.2) group = c(1, 1, 1, 1, 2, 2, 2, 2) mydata = data.frame(group, groupmean)
The repetition is because I have additional variables representing individual-level data (that I don't care about for now). I would like to reshape the above into a dataframe with only two lines, one for each group.
Thanks in advance!