[R] use tapply in a list which contains many data.frame
    Aimin Yan 
    aiminy at iastate.edu
       
    Wed Feb 28 18:17:53 CET 2007
    
    
  
I have a list like the following:
 > class(temp)
[1] "list"
 > names(temp)
  [1] "1A24" "1A57" "1A5J" "1A6X" "1AB7" "1AF8" "1AFI" "1AGG" "1AH9" "1AHL"
[11] "1AJ3" "1AJW" "1AK7" "1ALG" "1AOY" "1APF" "1AUZ" "1AZJ" "1AZK"
 > head(temp[[1]])
     pr   model    aa  omega
1 1A24 MODEL_1 1_ALA  84.47
2 1A24 MODEL_1 2_GLN  63.06
3 1A24 MODEL_1 3_TYR 107.72
4 1A24 MODEL_1 4_GLU  54.36
5 1A24 MODEL_1 5_ASP  67.01
6 1A24 MODEL_1 6_GLY 999.00
This Iist have 19 data.frame that has their name such as 1A24,1A57....
The above is the structure for  data.frame 1A24, pr have 1 level, 
model has 20 levels,aa has 189 levels
I want to get the following matrix for each data.frame in this list like this
1A24
              MODEL_1 MODEL_2 .....     MODEL_20   Mean_of_20_models 
Sd_of_20_models
1_ALA    84.47
2_GLN    63.06
3_TYR    107.72
4_GLU    54.36
5_ASP
6_GLY
same thing for other data.frame in this list
1A57
.....
1A5J
.....
Means_of_20_models is average of omega for 1_ALA in 20 models
Sd_of_20_models is standard deviation of omega for 1_ALA between 20 models
Does anyone has some advice on how to do this?
thanks
Aimin
    
    
More information about the R-help
mailing list