Thanks! That's what I need.
On Tue, Dec 29, 2009 at 1:33 PM, Dimitris Rizopoulos <
d.rizopou...@erasmusmc.nl> wrote:
> have a look at ?ave(), e.g.,
>
> A <- 1:10
> B <- factor(c(1,2,2,4,4,4,7,7,7,7))
>
> ave(A, B)
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
> farida...@gmail.com wrote:
>
>> D
have a look at ?ave(), e.g.,
A <- 1:10
B <- factor(c(1,2,2,4,4,4,7,7,7,7))
ave(A, B)
I hope it helps.
Best,
Dimitris
farida...@gmail.com wrote:
Dear R experts,
I would like to substitute the values of a vector, say A, with the average
values taken over a factor
For example, lets assum
Dear R experts,
I would like to substitute the values of a vector, say A, with the average
values taken over a factor
For example, lets assume
A
[1] 1 2 3 4 5 6 7 8 9 10
B
[1] 1 2 2 4 4 4 7 7 7 7
Levels: 1 2 4 7
I need to have
1.0 2.5 2.5 5.0 5.0 5.0 8.5 8.5 8.5 8.5 8.5
Thank you
3 matches
Mail list logo