Hi,
I like the aggregate version. Here is an implementation with sapply and
apply:
> data
X2 gbm_tcga lusc_tcga ucec_tcga_pub
1 gbm_tcga 1.0 0.14053719 -0.102847164
2 gbm_tcga 1.0 0.04413434 0.013568055
3 gbm_tcga 1.0 -0.200
Thanks JS
I think aggregate function is better.
Karim
Le 17 févr. 2015 08:33, "JS Huang" a écrit :
> Hi,
>
> I hope that someone can provide a better way to implement it. This is my
> implementation.
>
> > data
> X2 gbm_tcga lusc_tcga ucec_tcga_pub
> 1 gbm_tcga 1.000
Hi,
I hope that someone can provide a better way to implement it. This is my
implementation.
> data
X2 gbm_tcga lusc_tcga ucec_tcga_pub
1 gbm_tcga 1.0 0.14053719 -0.102847164
2 gbm_tcga 1.0 0.04413434 0.013568055
3 gbm_tcga 1.00
I named your data frame temp
> aggregate(temp[,-1], list(temp[,1]), function(x) sum(abs(x)>.2))
Group.1 gbm_tcga lusc_tcga ucec_tcga_pub
1 gbm_tcga4 1 0
2 lusc_tcga1 4 0
3 ucec_tcga_pub0 0 4
Cheer
4 matches
Mail list logo