[R] ask for data manipulation!

vinkwai wong 0034058 at fudan.edu.cn
Wed Jun 9 16:59:43 CEST 2004


i have such a data:
V1   V2   V3  V4
a    b    c   e
a    f    d   NA
b    d    e   f
h    d    NA  NA
a    d    f   e
¡­¡­
(V1,V2,V3,V4 can be any one of a, b, c, d, e, f, g, h. that is to say ,it has 8 possible values.)

and i want to change it the the following form:
a    b    c    d    e    f    g    h
8    7    6    2.5   5   2.5  2.5  2.5    #2.5is the mean of (4+3+2+1)
8    3    3     6    3    7   3    3      #3 is the mean of (5+4+3+2+1)
2.5  8    2.5   7    6    5   2.5   2.5    #2.5is the mean of (4+3+2+1)
3.5 3.5   3.5   7    3.5  3.5  3.5   8               #3.5is the mean of (6+54+3+2+1)
8   2.5   2.5   7    5    6   2.5    2.5
¡­¡­

i want to know if there is some easy way to achieve my goal using R?




More information about the R-help mailing list