Displaying 3 results from an estimated 3 matches for "grpmean".
Did you mean:
grmean
2011 Jul 16
1
Fwd: construct boxplots from data with varying column widths
...> ave(tmp$runtime)[1]
> [1] 41.8108
I would have guessed you would get an error, but maybe if ave() is
given no grouping factor it just returns a grand mean.
Try instead one of these:
aggregate(data2, data2$function. , FUN=mean)
tapply(data2$runtime, data2$function. , FUN=mean)
data2$grpmean <- ave( data2$runtime, data2$function. , FUN=mean)
The last one adds a column in the dataframe and could be useful for
identifying items that are some particular diastance away from thier
group mean.
--
David Winsemius, MD
West Hartford, CT
David Winsemius, MD
West Hartford, CT
2002 Jun 05
1
[Re: Re: Scaling on a data.frame]
...t to lose the binding to the other factors (FAC2, FAC3).
> Or can i only control it via order preserving - it seems unsave.
>
> Something like that would be nice:
> "by(d[1], FAC1) <- by(d[1], FAC1, scale)"
Hey,
finely this works (adapted from Prof. Ripleys suggestion):
grpmeans <- tapply(d$VALUE, d$FAC1, mean, na.rm=T)
d$c <- d$VALUE - grpmeans[d$FAC1]
grpscale <- tapply(d$c, d$FAC1, sd, na.rm=T)
d$cs <- d$c / grpscale[d$FAC1]
It was funny to get 3 eligible answers
but non of them worked at first go.
1) grpmeans <- tapply(d[1], FAC1, mean)
d$s <...
2002 Jun 04
2
Scaling on a data.frame
Hey,
hopefully there is an easy way to solve my problem.
All that i think off is lengthy and clumsy.
Given a data.frame d with columns VALUE, FAC1, FAC2, FAC3.
Let FAC1 be something like experiment number,
so that there are exactly the same number of rows for each level of FAC1
in the data.frame.
Now i would like to scale all values according to the center of its
experiment.
So i can apply s