table - R summaryBy or other summary method -
table - R summaryBy or other summary method -
i trying create summary table , having mental hang up. essentially, think want summaryby statement getting colsums subsets columns except factor summarize on.
my info frame looks this:
class="snippet-code-html lang-html prettyprint-override"> cluster go:0003677 go:0003700 go:0046872 go:0008270 go:0043565 go:0005524 comp103680_c0 10 0 0 0 0 0 1 comp103947_c0 3 0 0 0 0 0 0 comp104660_c0 1 1 1 0 0 0 0 comp105255_c0 10 0 0 0 0 0 0
what colsums columns after cluster using cluster grouping factor.
thanks in advance. have tried bunch of things. lastly ply ddply
class="snippet-code-html lang-html prettyprint-override">> groupcolumns = "cluster" > datacolumns = colnames(go_matrix_mf[,2:ncol(go_matrix_mf)]) > res = ddply(go_matrix_mf, groupcolumns, function(x) colsums(go_matrix_mf[datacolumns])) > head(res) cluster go:0003677 go:0003700 go:0046872 go:0008270 go:0043565 go:0005524 go:0004674 go:0045735 1 1 121 138 196 94 43 213 97 20 2 2 121 138 196 94 43 213 97 20
i not sure homecoming values represent, not represent colsums
thanks, bob
try:
> aggregate(.~cluster, data=ddf, sum) cluster go.0003677 go.0003700 go.0046872 go.0008270 go.0043565 go.0005524 1 1 1 1 0 0 0 0 2 3 0 0 0 0 0 0 3 10 0 0 0 0 0 1 r table dplyr
Comments
Post a Comment