On Mon, Jan 18, 2010 at 10:33 AM, Ivan Calandra <
ivan.calan...@uni-hamburg.de> wrote:

> I didn't understand from the help what really does the function rowMeans
> but it looks like it doesn't take into account the categorical variables (I
> want to calculate the means when the values of all categorical variables are
> the same, second part of aggregate). Moreover, ssfa_num contains only
> numeric variables, meaning that the categories will not be associated with
> it.
> I'm kind of confused with this approach.
> You think it would work for me?
>

Conditional index to subset the data:

ssfa_num_grp1 <- ssfa[10:24][CatCol == "Condition1"]
ssfa_num_grp2 <- ssfa[10:24][CatCol2 == "Condition2"]

Again to assign back to source dataframe:

ssfa$mean[CatCol == "Condition1"] <- ssfa_num_grp1

It should be fairly straight forward to roll it into a loop thereafter.

Ben

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to