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

        [[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