Sunday, 8 September 2013

R: Unlist pairwise comparisons p-values into dataframe

R: Unlist pairwise comparisons p-values into dataframe

I can apply the following code to apply a pairwiset.t.test function on
each column of a certain dataframe, A, against a dependent parameter, DEP.
apply(A, 2, function(x) pairwise.t.test(DEP, x, p.adj =
'bonferroni')$p.value)
The output for this function results in a list type data. Something like
the following shows:
$A
1 2 3 4
1 0.7236751 NA NA NA
2 0.7236751 0.7236751 NA NA
3 0.7236751 0.7236751 0.7236751 NA
4 0.7236751 0.7236751 0.7236751 0.7236751
$B
0
1 0.7236751
I would like to ask if there's a way to combine the two list mode data
such that:
1 2 3 4 5
1 0.7236751 NA NA NA 0.7236751
2 0.7236751 0.7236751 NA NA NA
3 0.7236751 0.7236751 0.7236751 NA NA
4 0.7236751 0.7236751 0.7236751 0.7236751 NA
Thank you all.

No comments:

Post a Comment