[R] How can I make a list using aggregate function?

sureshraj sureshmallikaraj at gmail.com
Thu Jun 28 16:10:34 CEST 2012


Hi freind, 
 My data seems to be like , and data frame name is comb.data
sequence               weight rsat.          zFEl 
1    CTTTTCTTGTT    4.6   0.00058  -7.452 3.237     
2    ACTTTGAGGTG    4.1   0.00077  -7.169 3.114    
3    GTCTTGAACTC    4.8   0.00055  -7.506 3.260     
4   GCTTTGAAGAA    6.6   0.00019  -8.568 3.721     
5    GCTTTCAACAT    7.0   0.00014  -8.874 3.854     
6   TCCTTGTTCAT    3.5   0.00099  -6.918 3.004     
 
So I need to use aggregate function based on sequence
column(by=list(comb.data$sequence) for zFE column and I should need to store
those results in lists..so result would be like 
 [[1]]
CTTTTCTTGTT     2.3758   3.237     
[[2]] 
ACTTTGAGGTG   1.78977  -5.11768684    
[[3]]
 GTCTTGAACTC    1.987455  1.260     
[[1]]
 GCTTTGAAGAA  1.019  0.72541     
[[4]]
 GCTTTCAACAT    0.0423   3.865754 
...so I made a code like this,,but i am facing some bugs as i mentioned
before,,could you please help to solve this one??I hope now you understand
my query...

the code is 
"data <- lapply(comb.data$zFE, function(x)
aggregate(x,by=list(comb.data[["sequence"]]), quantile,
probs=c(0.5,0.8,0.9), na.rm=T)) "


Thanks,,



--
View this message in context: http://r.789695.n4.nabble.com/How-can-I-make-a-list-using-aggregate-function-tp4634714p4634764.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list